Which PROC PRINT statement controls the order of the variables displayed in the report?
Correct Answer: C
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. References * SAS documentation for PROC PRINT.
Question 18
Given the SAS data set WORK PRODUCTS: How many variables does the WORK REVENUE data set contains?
Correct Answer: D
The resulting WORK.REVENUE data set contains 3 variables. In the provided SAS program, the set statement uses a (keep=) option to keep only 3 variables from WORK.PRODUCTS, which are ProdId, Price, and Sales. The drop= data set option in the data statement specifies to drop the Sales and Returns variables from the output data set. However, Returns was not included in the keep= option, so it won't be part of WORK.REVENUE to begin with. Finally, a new variable Revenue is calculated and included in the data set. Therefore, the final data set contains the variables ProdId, Price, and Revenue. References: * SAS documentation on keep= and drop= data set options.
Question 19
Given the following code: Which variables are created with the BY statement?
Correct Answer: A
In SAS, when you use a BY statement in a DATA step, SAS creates two temporary variables for each variable listed in the BY statement: one to indicate the first occurrence (FIRST.variable) and another to indicate the last occurrence (LAST.variable) of the value within the BY-group. Given the provided code and assuming that State is the variable used in the BY statement, SAS will create First.State and Last.State. Thus, option A is correct. References: * SAS documentation on the BY statement, SAS Institute.
Question 20
How does SAS display missing values?
Correct Answer: A
SAS handles missing values distinctively based on the data type of the variable. For numeric variables, SAS represents missing values with a period (.). For character variables, missing values are represented by a blank space. This handling is crucial for distinguishing between actual data entries and absent data, particularly in statistical calculations and data processing. Options B, C, and D incorrectly describe the representation of missing values in SAS, which does not use special characters like 'N', 'C', or '$' for this purpose. References:SAS documentation on handling missing data, SAS Institute.