SAS 9.4 Programming Fundamentals A00-215 Exam Questions

Page: 1 / 14
Total 78 questions
Question 1

Which statement is true about the DROP statement during the compilation phase of the DATA step?



Answer : A

The DROP statement during the compilation phase of the DATA step flags variables in the Program Data Vector (PDV) to be dropped when the data set is output. This means that although the variables exist in the PDV during the DATA step execution, they will not be written to the output data set. The DROP statement does not affect the order of variables (which is the purpose of the ORDER= data set option), nor does it remove variables from the input data set or prevent them from being created in the PDV.


SAS documentation on the DROP statement.

Question 2

Which SAS format displays a SAS date as 25JUN2019?



Answer : B

Option B is correct. The DATE9. format in SAS displays dates in the ddMMMyyyy format, which corresponds to the example given (25JUN2019). This format writes dates with a two-digit day, a three-character month abbreviation, and a four-digit year. The other options do not match the correct format:

A is incorrect because ddMMMyy9. format would display a two-digit year.

C is incorrect because there is no such format as Ddmmmyyyy9. in standard SAS formats.

D is incorrect because Dmy9. does not correspond to the required format.


SAS 9.4 documentation on date and time formats.

Question 3

What happens when you submit the code shown below?

data table1 table2;

set sashelp.shoes;

output;

run;



Answer : B

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.


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.

Question 4

Given the PROC PRINT report of the INVEST data set shown below:

How many observations are in the FORCAST data set after this program executes?



Answer : B

The FORCAST dataset is created from the INVEST dataset, which has 10 observations as seen in the PROC PRINT report. For each observation in INVEST, three new observations are added in FORCAST, one for each year's balance calculation (year=1, year=2, year=3). This is achieved by the output; statement after each balance calculation, which writes the current state of the data step to a new row in the dataset. Therefore, since there are 10 original observations, and each leads to three new observations, the total number of observations in the FORCAST dataset will be 30 (10 observations from INVEST multiplied by 3 years each).


SAS documentation on the DATA step and output statement, SAS Institute.

Question 5

How many statements are in the following PROC PRINT step?



Answer : C

In the provided image of the SAS code for the PROC PRINT step, the following statements are present:

proc print data=sashelp.cars; - PROC PRINT step beginning

var Make Model MSRP MPG_City MPG_Highway Horsepower Weight; - VAR statement to specify variables to print

format Weight comma8.; - FORMAT statement to apply a format to a variable

The final run; statement which would be necessary to execute the PROC PRINT step is not visible in the image, but it can be inferred to be there since every PROC step must be ended with a run; or quit; statement.

Thus, there are four statements related to the PROC PRINT step.


SAS 9.4 Language Reference: Concepts, 'PROC PRINT'

SAS documentation on 'VAR Statement' and 'FORMAT Statement'

Question 6

Which statement is true regarding a DATA step concatenation?



Answer : B

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.'


Question 7

Which statement is true about the SUM statement?



Answer : C

The SUM statement in SAS is used to sum values across observations, adding the value of the expression on the right side of the statement to the variable on the left. It does not use an equal sign (eliminating A), only one variable can be on the left-hand side of a SUM statement (eliminating B), and it is not initialized to 1 by default (eliminating D). What makes the SUM statement particularly useful is that it ignores missing values when summing across observations, which means that missing values do not affect the sum (option C is correct).


SAS documentation on the SUM statement, SAS Institute.

Page:    1 / 14   
Total 78 questions