Which statement is true regarding the SET statement?
Correct Answer: D
Question 32
What step has correct syntax for the CONTENTS procedure?
Correct Answer: C
The correct syntax for the CONTENTS procedure is to specify the dataset to be described using the data= option. The dataset should be identified by its library and name, separated by a period. The correct syntax is therefore Proc contents data=library.dataset;, which makes Option C the correct answer: Proc contents data=sashelp.shoes;. This statement will produce the contents of the dataset 'shoes' in the 'sashelp' library. References: * SAS documentation on the CONTENTS procedure, SAS Institute.
Question 33
Which step temporarily assign a format to the sales variable?
Correct Answer: D
The correct answer is D. This option uses the PROC PRINT procedure, which is used to print SAS data sets. The format statement within PROC PRINT temporarily assigns a format to a variable for the duration of the PROC PRINT step. Here is how it works: * data=sashelp.shoes; tells SAS which dataset to print. * Format sales comma12.; temporarily assigns a comma format to the sales variable, making it easier to read, especially if the numbers are large. The comma12. format adds commas for thousands, millions, etc., and displays the number in a field that is 12 characters wide. * The format is only applied for the duration of the PROC PRINT step and does not permanently change the dataset. The other options are incorrect for the following reasons: * Option A attempts to use a PROC FORMAT step, which is for creating custom formats, not for assigning formats to variables in a dataset. * Option B uses a DATA step which could permanently assign the format to the sales variable if it were * syntactically correct (it should be set sashelp.shoes; instead of Set sashelp,sheoes;). * Option C mentions PROC CONTENTS which displays metadata about variables in a dataset and does not have the capability to assign formats. References: * SAS 9.4 documentation for the PROC PRINT statement: SAS Help Center: PROC PRINT
Question 34
Given the following SAS program: What footnotes appear for the second PROC PRINY report?
Correct Answer: D
In SAS, footnotes are set using the footnote statement and they will appear on all subsequent output until they are either changed or cleared. Based on the second image provided with the SAS code, the footnote for the second PROC PRINT report is set immediately before it runs. The code sets footnote1 as 'Created by HR' and footnote2 as 'Confidential' initially. However, before the second PROC PRINT step, footnote2 is redefined as 'Draft - Do Not Distribute'. Since footnote1 is not redefined or cleared, it is no longer in effect for the second report. Therefore, the only footnote that appears for the second PROC PRINT report is what is defined for footnote2 at that point in the code, which is 'Draft - Do Not Distribute'. That's why the correct answer is D. References: * SAS 9.4 documentation for the FOOTNOTE statement: SAS Help Center: FOOTNOTE Statement
Question 35
Given the input data set INVENTORY as shown below: Two output data sets are desired, CHIPS and OTHERSNACKS. * The CHIPS data set should only include QtySold, Price, and Product. * The OTHERSNACKS data set should include QtySold, Price, product, and Type. Which Data step creates the two desired output data sets
Correct Answer: B
Option B is the correct answer. This code will create two datasets as described. The keep= option in the data chips statement will ensure that only QtySold, Price, and Product are kept in the chips dataset, and because othersnacks does not have a keep= option, it will contain all the variables from the input dataset. The if-then-else logic directs the observations to the correct dataset based on the Type value. Option A incorrectly uses a keep statement within the if block, which is not valid syntax. Option C attempts to use a keep statement after the output statement, which will not correctly subset the variables for the chips data set. Option D incorrectly applies the keep= option to the set statement, which would affect both output data sets, not just chips. References: * SAS documentation on the output statement. * SAS documentation on subsetting data in the DATA step.