Which statement is true regarding the XLSX engine in the LIBNAME statement?
B
Explanation:
The correct answer is B: The XLSX engine can read and write data in Microsoft Excel workbooks. This
functionality allows SAS users to directly access and manipulate data stored in Excel files using the
.xlsx extension. The XLSX engine does not automatically concatenate individual worksheets; instead,
each worksheet is accessed separately. Also, it specifically works with files that have the .xlsx
extension, not the older .xls format, thus eliminating option C. Option D is incorrect because the
XLSX engine requires the correct file extension (.xlsx) in the LIBNAME statement to properly identify
and interact with Excel files.
Reference:
SAS documentation on LIBNAME statement for XLSX engine: SAS Support: LIBNAME Statement
Which ODS EXCEL statement correctly creates an Excel using the ANALYSIS style?
A
Explanation:
The correct answer is A: Ods excel='c:\report.xlsx' style=analysis;. This syntax is correct for the ODS
EXCEL statement in SAS, where you specify the path and filename, followed by the 'style' option to
apply a specific style template to the output Excel file. The 'style=analysis' is used to set the output
appearance according to the 'ANALYSIS' style template provided by SAS. Option B is syntactically
incorrect and does not use the 'style' option correctly. Option C incorrectly places a slash which is not
syntactically valid in this context, and Option D misses the equals sign and quotes which are
necessary for correct syntax in SAS.
Reference:
SAS documentation on ODS EXCEL statement: SAS Support: ODS EXCEL Statement
Which PROC IMPORT step correctly creates the MYDATA,SALES data set from the SALES.SCV file?
B
Explanation:
The correct statement to import a CSV file into SAS and create a dataset is option B. The PROC
IMPORT statement is used in SAS to read data from external files and create a SAS data set. Let's
break down why option B is correct:
datafile= specifies the location and filename of the external data file. In this case, "sales.csv" is the
correct filename and format for a CSV file.
dbms=csv tells SAS that the format of the external data file is CSV (comma-separated values).
out=mydata.sales; specifies the name of the output SAS dataset. It consists of two parts: the libref
mydata and the dataset name sales. This tells SAS to store the new dataset in a library called mydata
with the dataset name sales.
Option A uses an incorrect syntax as it incorrectly specifies the data= option, which is not valid in this
context. Also, the out= option is incorrectly quoted and terminated with a semicolon within the
quotes.
Option C has a typo in the out= option (out=mydata.gales;), which incorrectly specifies the output
dataset name. Additionally, it incorrectly specifies the data= option, which should actually be
datafile=.
Option D has incorrectly quoted the out= option and uses a hyphen instead of an equals sign.
Additionally, it does not use quotes around the filename, which may cause issues if the filename
contains special characters or spaces.
Reference:
SAS 9.4 documentation, specifically the PROC IMPORT statement: SAS Help Center: PROC IMPORT
Statement
Which PROC MEANS program creates the report below?
A
Explanation:
The PROC MEANS statement is used to compute descriptive statistics of data in SAS. Option A is the
correct code to produce the report shown in the first image because of the following reasons:
data=sashelp.shoes specifies the dataset on which the procedure is to be performed.
sum mean specifies that the summary statistics should include the sum and mean of the variables.
var Sales; specifies that the variable Sales is the analysis variable for which the summary statistics are
to be computed.
class Product; specifies that the procedure should classify results by unique values of the Product
variable. This will produce separate statistics for each type of product, which aligns with the structure
of the report provided in the image.
Options B, C, and D are incorrect for the following reasons:
B uses group instead of class, and group is not a valid statement in the context of PROC MEANS. Also,
var Sale; is incorrect as the variable name is Sales.
C includes nobe; which is not a valid SAS option and seems to be a typo. The by statement is used for
sorting data, not for classifying groups as class does.
D incorrectly uses sum Salad; and mean Sales; as separate statements and has an invalid use of by
product; which is not needed here.
Reference:
SAS 9.4 documentation for the PROC MEANS statement: SAS Help Center: PROC MEANS
Given the following SAS program:
What footnotes appear for the second PROC PRINY report?
D
Explanation:
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.
Reference:
SAS 9.4 documentation for the FOOTNOTE statement: SAS Help Center: FOOTNOTE Statement
Which step temporarily assign a format to the sales variable?
D
Explanation:
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.
Reference:
SAS 9.4 documentation for the PROC PRINT statement: SAS Help Center: PROC PRINT
Given the partial report shown below:
Which step will produce this report?
D
Explanation:
The report shown is a cross-tabulation of 'Region' by 'Product'. The FREQ Procedure indicates that
PROC FREQ has been used, and the presence of 'Frequency', 'Percent', 'Row Percent', and 'Column
Percent' suggests that a cross tabulation (or contingency table) has been requested. The correct code
for this output would include the tables statement to specify the two variables ('Region' and
'Product') with an asterisk between them, which indicates a request for a cross-tabulation of these
two categorical variables, and the crosslist option to display the table in a cross-tabulated list format.
Therefore, option D is the correct answer:
proc freq data=sashelp.shoes;
tables region*product / crosslist;
run;
Options A and C use the order=freq option incorrectly, as this option would order the table by
frequency counts rather than providing a cross-tabulation. Option B is missing the crosslist option
needed to produce the cross-tabulated format.
Which PROC PRINT option displays variable labels in the report?
D
Explanation:
In the PROC PRINT statement, the LABEL option is used to display variable labels in the report. If the
variables in the dataset have labels associated with them, the LABEL option will ensure that these
labels are used in the output instead of the variable names.
Here's how the LABEL option is used:
proc print data=sashelp.class label; (assuming sashelp.class is the dataset in question)
The LABEL keyword after the dataset name within the PROC PRINT call activates the use of variable
labels in the output report.
The other options provided are incorrect for the following reasons:
SHOWLABELS is not a valid SAS option.
COLS does not exist as a PROC PRINT option in SAS.
LABELS= is not a correct syntax for any SAS procedure.
Reference:
SAS 9.4 documentation for the PROC PRINT statement with LABEL option: [SAS Help Center: PROC
PRINT]
Which LABEL statement has correct syntax?
B
Explanation:
In SAS, the correct syntax for assigning labels to variables is to use the LABEL statement within a
DATA step or a PROC step. Labels are assigned to variables using the format variable='label'. The
correct syntax for the LABEL statement is represented by option B.
Here’s the breakdown:
FName=’First Name’ correctly assigns the label First Name to the variable FName.
LName=’Last Name’ correctly assigns the label Last Name to the variable LName.
Each variable and label pair is separated by a space, and the overall statement ends with a
semicolon, which is the proper syntax for a LABEL statement in SAS.
Options A, C, and D are incorrect due to various syntax errors like the use of the wrong character for
the apostrophe, missing apostrophes, incorrect punctuation, and in the case of option C, an incorrect
conjunction ‘and’ which is not used in LABEL statements.
Reference:
SAS 9.4 documentation for the LABEL statement: SAS Help Center: LABEL Statement
Given the display of the CITIES data set:
Which program creates the PROC PRINT report below?
B
Explanation:
The PROC PRINT statement is used for printing SAS datasets. To customize the column headers in the
report, you use the label statement within the PROC PRINT procedure to assign new labels to
variables, and the label option in the PROC PRINT to activate these labels. The noobs option
suppresses the printing of observation numbers in the report.
Option B has the correct syntax for what is being requested:
proc print data=cities label noobs; specifies the dataset to print with the label option to display
variable labels and noobs to hide the observation numbers.
label Name='Employee Name' City='Birth City'; assigns the label 'Employee Name' to the 'Name'
variable and 'Birth City' to the 'City' variable.
run; signifies the end of the PROC PRINT procedure.
Options A, C, and D are incorrect due to syntax errors:
A uses an incorrect option showlabelse instead of label and noobs.
C is incorrect because it lacks the label option in the proc print statement which is necessary to
actually display the labels, and the labels are being incorrectly used within the proc print instead of
in a label statement.
D has several issues: there is no display statement in SAS, the option noobs should be outside of the
proc print statement, and the labels should be defined in a label statement, not within proc print.
Reference:
SAS 9.4 documentation for the PROC PRINT statement: SAS Help Center: PROC PRINT
Which PROC MEANS statements specifies variables to group the data before calculating statistics?
A
Explanation:
In the context of the PROC MEANS procedure in SAS, the CLASS statement is used to specify
categorical variables whose unique values group the data before calculating statistics. This allows
PROC MEANS to calculate statistics like the mean, sum, or standard deviation for each class or group
of data defined by the CLASS variables.
The CLASS statement works as follows:
class variable-list; specifies one or more variables to define groups for analysis.
When used, PROC MEANS computes the requested statistics for each level of the variables listed,
which can be very helpful for analyzing how groups compare across different statistics.
The other options are not used in the PROC MEANS procedure to specify grouping of data:
B . GROUP is not a valid statement in PROC MEANS.
C . SUMBY is not a valid statement in SAS.
D . VAR is used in PROC MEANS to specify the analysis variables for which statistics are to be
computed, not to group the data.
Which program generates the PROC MEANS report below?
D
Explanation:
The PROC MEANS report shown in the image displays statistics for a single variable Age with no
decimal places. The correct SAS code to generate such a report is option D, which uses the PROC
MEANS procedure with the maxdec=0 option to control the number of decimal places displayed (in
this case, zero) and specifies Age as the analysis variable using the var statement.
The PROC MEANS procedure computes descriptive statistics for numeric variables. The maxdec=0
option is used here to remove decimal places from the report output, which matches the output
shown where the mean, standard deviation, minimum, and maximum are all integers.
The other options are incorrect for the following reasons:
A uses the class statement, which is not appropriate here because Age is not a classification variable
but an analysis variable.
B uses the group statement, which is not a valid statement in the PROC MEANS procedure.
C uses the by statement, which requires the data to be sorted by the BY variable and does not fit the
output provided since it would produce separate statistics for each value of Age.
Reference:
SAS 9.4 documentation for the PROC MEANS statement: SAS Help Center: PROC MEANS
Given the report shown below:
Which PROC PREQ step creates the frequency report?
B
Explanation:
The report shown in the image is a two-way frequency table generated by the PROC FREQ procedure
which shows the frequency and percentage distribution of two categorical variables. The correct
answer is option B:
proc freq data=cars; tells SAS to use the PROC FREQ procedure on the dataset cars.
tables make*drivetrain; requests the frequency table for the cross of make and drivetrain. The
asterisk (*) denotes a two-way table of the two categorical variables.
run; indicates the end of the proc freq step.
The resulting table in the output has the statistics for Make broken down by Drivetrain category,
which matches the structure seen in the provided image.
Options A, C, and D do not correctly request the two-way table of make by drivetrain. Specifically, C
and D reverse the order, which would change the orientation of the table in the output, and A is
missing the asterisk (*) which is needed for the cross-tabulation of the two variables.
Reference:
SAS 9.4 documentation for the PROC FREQ statement: SAS Help Center: PROC FREQ
Which PROC SORT option allows you to create an output data set of the sorted data?
D
Explanation:
In SAS, the PROC SORT procedure is used to sort data. To save the sorted data into a new dataset,
the OUT= option is used in the PROC SORT statement. This option allows you to specify the name of
the output dataset that will contain the sorted data.
Here is how it's used:
proc sort data=original out=sorted; by variable; run; will sort the dataset original by variable and
create a new dataset named sorted containing the sorted data.
Option A, Data=, is not valid for the PROC SORT procedure. Option B, SORTOUT=, is a common
misconception but is not correct; OUT= is the right option. Option C, OUTPUT=, is not used within
PROC SORT; it is used in other procedures such as PROC TABULATE and PROC SUMMARY for output
datasets.
Reference:
SAS 9.4 documentation for the PROC SORT statement: SAS Help Center: PROC SORT
The following program is summited:
The following report is created:
However, the desired report is shown below:
What change is needed to display the desired formatted values for the Answer varia
C
Explanation:
When defining custom formats in SAS, it's important to adhere to the correct syntax, which includes
ending format names with a period. In the submitted program, the format $convert is defined
without a period at the end of the format name in the VALUE statement. This is likely causing an
error since format names in the VALUE statement should always end with a period. Option C
correctly identifies that adding a period to the end of the format name on the VALUE statement will
allow SAS to properly recognize and apply the custom format to the Answer variable when the PROC
PRINT step is executed.
The program provided in the question seems to have formatting errors, but based on the information
provided, the suggested change is to add a period to make it $convert. which would correctly apply
the format.
The other options would not resolve the issue of applying the custom format:
A . Changing the case of the unformatted values will not help if the format is not correctly specified.
B . The comma does not seem to be the issue based on the context given.
D . The dollar sign is correct and necessary for character formats; removing it would cause the format
to be invalid for character data.
Reference:
SAS 9.4 documentation for the FORMAT procedure: SAS Help Center: PROC FORMAT