Practice Free A00-215 Exam Online Questions
Which program generates the PROC MEANS report below?
- A . proc means data=sashelp.class nodec;
class Age; run; - B . proc means data=sashelp. class;
group Age;
run; - C . proc means data=sashelp. class;
by Age;
run; - D . proc means data=sashelp. class maxdec=0;
var Age;
run;
Which assignment statement uses the SUBSTR function to extract the four-digit year from the value of date?
data days;
date="02Apr2019";
insert-statement-here
run;
- A . year=substr (date, 7, 4) ;
- B . year=substr (date, 4, 6) ;
- C . year=substr (date, 6, 4) ;
O D) year=substr (date, 4, 7) ;
A
Explanation:
In SAS, the SUBSTR function is used to extract a substring from a character string.
The function syntax is SUBSTR ( string, position, length), where:
string is the variable or string literal you want to extract the substring from.
position is the starting position of the substring within string.
position starts counting at 1 in SAS, not 0 as in some other languages.
length is the number of characters to extract.
For the value of date provided ("02Apr2019"), we want to extract the year, which is the four characters at the end of the string.
Here’s how each option would work given the string:
A) year=substr(date, 7, 4);
This starts at the 7th character of the string ("2019") and extracts 4 characters, which correctly represents the year.
B) year=substr(date, 4, 6);
This starts at the 4th character ("Apr2019") and would extract 6 characters, which gives us "Apr201", not just the year.
C) year=substr(date, 6, 4);
This starts at the 6th character ("r2019") and would extract 4 characters, resulting in "r201", which is not correct.
D) year=substr(date, 4, 7);
This starts at the 4th character and would extract 7 characters, resulting in "Apr2019", which is the whole string from the 4th character to the end, not just the year.
The correct answer is A, as it extracts the four-digit year from the end of the string.
Reference: The SAS documentation on the SUBSTR function, which details how to use it for extracting parts of strings.
SAS programming tutorials that often provide examples of common functions like SUBSTR for string manipulation
Which line contains a syntax error?
- A . Line 3
- B . Line 1
- C . Line 2
- D . Line 5
CORRECT TEXT
Given the following DATA step:
What is the value of average? Enter your numeric answer in the space above.
Which statement is true about SAS program syntax?
- A . Any statement that begins with an & is a comment and will not execute.
- B . Global statements (such as LIBNAME) need a RUN statement to execute.
- C . Character values in quotation marks are case sensitive.
- D . SAS cannot process steps with multiple statements on the same line.
C
Explanation:
In SAS program syntax, character strings are indeed case sensitive when enclosed in quotation marks. If you compare two character strings of the same letters but different cases, SAS will treat them as different values. For example, ‘Hello’ is not the same as ‘hello’.
Option A is incorrect because the ampersand (&) is not used for comments in SAS; it is used for macro variable references. Option B is incorrect because global statements such as LIBNAME and options do not require a RUN statement to execute. Finally, option D is incorrect because SAS can process steps with multiple statements on the same line, provided that they are correctly separated by semicolons.
Reference
SAS 9.4 Language
Reference: Concepts, "SAS Language Elements and Syntax."
7 1. Which statement is true regarding a DATA step concatenation?
Which ODS EXCEL statement correctly creates an Excel workbook using the ANALYSIS style?
- A . ods excel workbook=’c:report.xlsx’ / analysis;
- B . ods excel ‘c:report.xlsx’ / analysis;
- C . ods excel=’c: report.xlsx’ style=analysis;
- D . ods excel file=’c:report.xlsx’ style=analysis;
D
Explanation:
The correct syntax for creating an Excel workbook using the ODS (Output Delivery System) Excel destination with a specific style is provided by option D.
The syntax is as follows: ods excel file=’c:report.xlsx’ style=analysis;
This statement instructs SAS to output the results of subsequent procedures to an Excel workbook located at c:report.xlsx, applying the ANALYSIS style to the output. The file= option specifies the path and name of the Excel file to be created or overwritten, and the style= option indicates the style template to be used for the output. The ANALYSIS style is one of the predefined styles that can be applied to the output to control the appearance of tables and graphs. Other options like A) and B) are incorrect due to syntax errors and misplacement of keywords. Option C) has a typo in the file path and incorrect syntax usage.
Reference: SAS 9.4 Output Delivery System: User’s Guide.
Which statement is true about the SUM statement?
- A . The SUM statement includes an equal sign.
- B . Multiple accumulating variables can be created with one SUM statement.
- C . The SUM statement ignores missing values.
- D . By default, the accumulating variable is initialized to 1.
Which step temporarily assign a format to the sales variable?
- A . Proc format; Formatsales comma12.; Run;
- B . Data sasuer. Shoes Set sashelp,sheoes; Format sales comma12.;
- C . Proc contents data=sashelp.shoes; Format Sales comma12.; Run;
- D . Proc print data= sashelp. Shoes Format sales comma12.; Run;
Given the data sets AMERICIAN NATIONAL and results in the data set BASEBALL shown below:
AMERICAN
NATIONAL BASEBALL
Which DATA step correctly creates the BASEBALL data set?
- A . data baseball; set american (rename=(Team=TeamName)) national; run;
- B . data baseball; set american national; run;
- C . data baseball; setAmerican(rename=(TeamName=Team)) national; run;
- D . data baseball; set national American; run;
How many statements are In the program shown below?
- A . 9
- B . 6
- C . 10
- D . 2