The correct answer is A. The SET statement in SAS is used within a DATA step to specify which existing SAS dataset is to be read. This statement is used to read in data from an existing SAS dataset to be processed in the current DATA step. The SET statement does not specify an output data set; that is determined by the name specified in the DATA statement.
Options B, C, and D are incorrect because:
B and C are incorrect as the SET statement is not used in the PROC SORT step at all.
D is incorrect because the SET statement specifies the input dataset, not the output dataset, in the DATA step.
References:
SAS 9.4 Language Reference: Concepts, "DATA Step Processing"
SAS documentation on the SET statement.
Question 2
Given the code shown below:
What will be the format for MSRP in the RPOC PRINT output?
Options:
A.
There is a syntax error in the FORMAT statement in the PROC PRINT step.
B.
Comma12. 2
C.
Dollar10.
D.
Dollar12.
Answer:
B
Explanation:
Explanation:
The FORMAT statement in the DATA step assigns formats to variables for the SAS dataset being created. In the code provided, MSRP is given the dollar12. format and Invoice is given the dollar10. format. However, during the PROC PRINT step, MSRP is reassigned to the comma12.2 format. The format specified in the most recent PROC step or DATA step that executes is the one that is used in the output.
Therefore, the format for MSRP in the PROC PRINT output will be comma12.2, making the answer: B. Comma12.2
References:
SAS documentation on PROC PRINT and FORMAT statement, SAS Institute.
Question 3
How many statements are in the following PROC PRINT step?
Options:
A.
5
B.
3
C.
4
D.
1
Answer:
C
Explanation:
Explanation:
In the provided image of the SAS code for the PROC PRINT step, the following statements are present:
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.
References:
SAS 9.4 Language Reference: Concepts, "PROC PRINT"
SAS documentation on "VAR Statement" and "FORMAT Statement"