Questions for the A00-215 were updated on : Nov 21 ,2025
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
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
What happens when you submit the code shown below?
data table1 table2;
set sashelp.shoes;
output;
run;
B
Explanation:
In SAS, the code you provided involves creating two datasets, table1 and table2, from the dataset
sashelp.shoes. The key part to understand here is how the DATA statement and OUTPUT statement
interact with the specified datasets.
DATA Statement: The statement data table1 table2; initiates the creation of two new datasets named
table1 and table2.
SET Statement: The set sashelp.shoes; statement is used to read data from the sashelp.shoes
dataset. This dataset includes data on shoe sales from SASHELP library, which is commonly used for
demonstration purposes in SAS.
OUTPUT Statement: In the context of the DATA step where multiple datasets are specified in the
DATA statement (as in table1 table2), the OUTPUT statement without a dataset name specified
outputs the current observation to all datasets listed in the DATA statement. This is a critical point
because it determines where the data goes after processing in the DATA step.
Execution: When the run; statement is executed, it processes each observation from sashelp.shoes.
For each observation, because there is no condition or additional OUTPUT statements specifying
dataset names, each observation is output to both table1 and table2.
Therefore, the correct behavior as described is that each observation in sashelp.shoes is written to
both table1 and table2. This effectively duplicates each row from the source into both target
datasets.
Reference:
SAS 9.4 Language Reference: Concepts, "DATA Step Processing" and "OUTPUT Statement" sections
provide detailed explanations on how DATA steps process and how OUTPUT statement works in
different contexts.
Practical examples and explanations from SAS programming courses and official SAS documentation,
which discuss DATA and SET statements, and their interaction with OUTPUT in data duplication
scenarios.
Given the STUDENTS data set below:
What will be the values for First. State and Last. State for Ellen's observation?
D
Explanation:
When using a BY statement in a DATA step, SAS creates two temporary variables for each BY variable:
FIRST.variable and LAST.variable. These are used to indicate the beginning and end of each BY group.
For Ellen's observation:
First.State=1 because this is the first occurrence of the state "OH" in the dataset when sorted by the
state variable, which makes it the beginning of a new group for "OH".
Last.State=0 because Ellen is not the last observation
for the state "OH" group. In the given dataset snippet, there appears to be only one observation for
the state "OH", but since the data is sorted by state, and we don't see another "OH" below Ellen, we
can deduce that Ellen's observation is not the last "OH" observation in the entire dataset. If there
were no more "OH" observations following Ellen's, then Last.State would be 1.
The FIRST.variable is set to 1 for the first observation in each BY group and 0 for all other observations
in the group. Conversely, LAST.variable is set to 1 for the last observation in each BY group and 0
otherwise. Since we're assuming that the dataset is larger than the snippet shown, and the data
continues beyond what is visible, we must assume there are more observations for "OH" unless
indicated otherwise.
Reference
"SAS 9.4 Language Reference: Concepts." SAS Institute Inc.
"BY-Group Processing" in "SAS Programming 1: Essentials" course material, SAS Institute.
Which sentence is true regarding the VALUE statement in the FORMAT procedure?
C
Explanation:
In SAS, the FORMAT procedure (PROC FORMAT) allows users to create custom formats that can be
used to change the way data is displayed without altering the data itself. The VALUE statement within
PROC FORMAT is a key component of this procedure.
The VALUE statement can indeed create both numeric and character formats, which is why option C
is correct. Numeric format names typically do not start with a $ sign (this is reserved for character
format names), and the keyword UNKNOWN is not a part of the VALUE statement syntax; it is used in
a different context within PROC FORMAT, specifically for handling undefined data values when using
custom formats.
Moreover, the LIB= option is not used within the VALUE statement. The LIB= option is used at the
PROC FORMAT level to specify the library where the formats should be stored or from which they
should be read.
Reference
SAS 9.4 documentation for the PROC FORMAT and VALUE statement.
"SAS Formats and Informats." in "Step-by-Step Programming with Base SAS 9.4" from the SAS
Institute.
Which PROC SORT statement specifies the sort variable?
B
Explanation:
The PROC SORT statement that specifies the sort variable is: BY
The BY statement in PROC SORT is used to specify the variable(s) by which the data should be sorted.
Which step reads the SASHELP. BASEBALL data set and creates the temporary data set CATCHERS?
D
Explanation:
The step that reads the SASHELP.BASEBALL data set and creates the temporary data set CATCHERS is:
data catchers;
set sashelp.baseball;
where position='C';
run;
This DATA step creates a new data set named catchers by reading in data from sashelp.baseball and
selecting only those observations where the variable position has the value 'C', which stands for
catchers.
The data set SASHELP. CARS contains information on different vehicles. How do you correctly write
the observations with Type of 'SUV' to the suv data set and Type
of 'Sedan' to the sedans data set?
B
Explanation:
The correct syntax for creating two separate data sets based on a condition in SAS involves using a
single DATA step with multiple data set names followed by a SET statement and conditional OUTPUT
statements. Here's a breakdown of why option B is the correct answer:
data SUV Sedans;
set sashelp.cars;
if Type = 'SUV' then output SUV;
else if Type = 'Sedan' then output Sedans;
run;
This option correctly uses a single DATA step to declare two data sets (SUV and Sedans). It reads from
the sashelp.cars data set and uses conditional statements to output observations to the respective
data sets based on the value of the Type variable. The output statement is used to explicitly direct
observations to the specified data set.
Option A: The syntax data=SUV data=Sedans; is incorrect. The correct syntax to create multiple data
sets in a DATA step does not include equal signs (=).
Option C: The syntax within the conditional statements is incorrect (if Type = SUV and if Type =
Sedan). The values for Type should be enclosed in quotes to specify that they are strings.
Option D: The syntax data= (SUV Sedans) ; is incorrect. The correct method to declare multiple data
sets in a DATA step does not use parentheses or an equal sign.
Reference:
The correctness of option B is based on standard SAS programming practices for conditional data
manipulation within a DATA step. This approach is commonly documented in SAS programming
resources such as the SAS 9.4 documentation and various SAS programming guides. The use of the
output statement for directing data to specific datasets based on conditions is a fundamental
technique in efficient data handling in SAS.
Which statement is true regarding a DATA step concatenation?
B
Explanation:
In a DATA step concatenation in SAS, when multiple datasets are listed in a SET statement, SAS
concatenates the datasets vertically, stacking them one on top of the other. The length of variables in
the resulting dataset is determined by the first dataset that appears in the SET statement. If the same
variable appears in multiple datasets, SAS uses the length as it is first encountered. It does not
require columns with the same name to be renamed; rather, it stacks them directly. There is no
maximum number of tables that can be listed in a SET statement for concatenation; more than two
can be concatenated. Lastly, concatenation combines data vertically, not horizontally as option D
suggests.
Reference
SAS 9.4 Language Reference: Concepts, "Concatenating Data Sets."
Which statement is true about SAS program syntax?
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."
____ steps typically report, manage, or analyze data.
Enter your answer in the space above. Case is ignored.
DATA
Explanation:
In SAS, the DATA step is a powerful tool that allows programmers to perform a variety of tasks such
as reporting, managing, and analyzing dat
a. The DATA step processes data one observation at a time, making it highly efficient for data
manipulation tasks. It enables the creation of new datasets, modification of existing ones, and
complex data transformations. Additionally, within a DATA step, you can use a wide range of
programming statements and functions to calculate new variables, merge or sort datasets, and
perform conditional processing. The flexibility and functionality provided by DATA steps make them a
fundamental part of SAS programming for handling and preparing data for further analysis or
reporting.
Reference: SAS 9.4 Language Reference: Concepts.
Which PROC PRINT statement controls the order of the variables displayed in the report?
C
Explanation:
In PROC PRINT, the VAR statement is used to control the order of the variables displayed in the
report. You can list the variables in the order you want them to appear. The KEEP statement can
control which variables appear, but not their order. DROP and SELECT are not valid statements within
PROC PRINT for controlling the order of variables.
Reference
SAS documentation for PROC PRINT.
Which PROC MEANS step generates the report below?
A
Explanation:
The correct syntax for generating the mean and standard deviation for specified variables using PROC
MEANS is shown in option A. The PROC MEANS statement specifies the dataset to analyze
(data=class) and includes the options (mean std) directly in the PROC statement. The VAR statement
then lists the variables for which the statistics should be calculated (Height and Weight). The other
options listed in B, C, and D are not correct syntax for PROC MEANS.
Which PROC MEANS statement specifies the numeric variables to analyze?
D
Explanation:
The VAR statement in PROC MEANS is used to specify the variables for which you want to calculate
the descriptive statistics such as the mean and standard deviation. You list the names of one or more
numeric variables after the VAR statement to include them in the analysis. Therefore, option D is the
correct answer.
Reference
SAS documentation for PROC MEANS.
Which ODS EXCEL statement correctly creates an Excel workbook using the ANALYSIS style?
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 program assigns the library reference exlib to the CLASS. XLSX workbook and displays the
CLASS_TEST worksheet?
D
Explanation:
The correct answer is option D, which uses the LIBNAME statement correctly to assign a library
reference to an Excel workbook and specifies the correct syntax for accessing a worksheet within that
workbook. The syntax for this option is:
libname exlib xlsx "c:\class.xlsx";
proc print data=exlib.class_test;
run;
This code snippet assigns the library reference exlib to the Excel workbook located at c:\class.xlsx
using the XLSX engine. The PROC PRINT step is then used to display the contents of the worksheet
named CLASS_TEST within that workbook. The library reference exlib combined with the dataset
name class_test (following the .) correctly specifies the worksheet to be printed. The other options
(A, B, C) are incorrect due to various reasons: incorrect syntax for the LIBNAME statement, incorrect
specification of the dataset to be printed, and incorrect path specifications.
Reference: SAS 9.4 Guide to Software Updates.