Font size
WorksheetsSAS All Units
Total questions: 150
Worksheet time: 1hrs 15mins
How many steps does this program contain?
one
two
four
eight
Running a SAS program can create which of the following?
log
output data
results
all of the above
Which of the following is a SAS syntax requirement?
Begin each statement in column one.
Begin each statement in column one.
Begin each statement in column one.
End each statement with a semicolon.
How many statements does this program contain?
five
six
seven
eight
Which of the following steps is typically used to generate reports and graphs?
DATA
PROC
REPORT
RUN
Does this comment contain syntax errors?
No. The comment is correctly specified.
Yes. Every comment line must end with a semicolon.
Yes. The comment is on more than one line.
Yes. There is a semicolon in the middle of the comment.
What result would you expect from submitting this step?
a report of the work.newsalesemPs data set
an error message in the log
the creation of a table named work.newsalesemps
What happens if you submit the following program?
SAS does not execute the step.
SAS assumes that PROC is misspelled and executes the step.
This program contains a syntax error because National is in different cases.
True
False
Which of the following is not a SAS programming interface?
SAS Enterprise Guide
SAS Manager
SAS Studio
SAS windowing environment
In this PROC CONTENTS output, what is the default length of the Birth_Date column?
4 bytes
8 bytes
32,767 bytes
It does not have a default length.
Which LIBNAME statement has the correct syntax?
libname reports "filepath/workshop";
libname orion filepath/workshop;
libname 3456a "filepath/workshop";
Which of the following tables is available at the beginning of a new SAS session?
sales
work.newsalesemps
sashelp.class
In this table, what type of column is Em ployee_ID?
character
numeric
temporary
missing
Which statement about SAS dates is false?
A SAS date is one of three of SAS column types: numeric, character, and date.
SAS dates represent the number of days from January 1, 1960.
SAS date values can be positive or negative.
SAS date values can be used in calculations.
Which LIBNAME statement has the correct syntax for reading a Microsoft Excel file?
libname excel "filepath/myexcelfile";
libname mydata xlsx "filepath/myexcelfile";
libname mydata xlsx "filepath/field_data.xlsx";
Which library name (libref) is valid?
2010Car
car/2010
car2010
cars_2010
To disassociate a libref that you previously assigned, you can use the UNASSIGN option in the LIBNAME statement.
True
False
What does this code do?
It creates a SAS table named Bi rd817 in the Work library from the CSV file bird_count and replaces Bird817 whenever the CSV file is updated.
It creates a SAS table named Bird817 in the Work library from the CSV file bird_count.
It uses the CSV engine to directly read the data file bird_count.csv.
In which portion of a SAS table are the following found?
• name of the table
• type of the column Salary
• creation date of the table
descriptor portion
data portion
Which of the following is a valid name for a character format?
country
$ctry
$country.
_country
Which of the following FORMAT statements was used to create this output?
format Order_Date date9. Delivery_Date mmddyy8.;
format Order_Date date7. Delivery_Date mmddyy8.;
format Order_Date ddmmmyy. Delivery_Date mmddyy8.;
format Order_Date monyy7. Delivery_Date mmddyy8.;
The format name must include a period delimiter in the FORMAT statement.
True
False
Which row or rows are selected by the following WHERE statement?
row 1
row 2
row 3
rows 1 and 2
all rows
Which statement about this PROC SORT step is true?
The sorted table overwrites the input table.
The rows are sorted by Salary in descending order, and then by Manager_ID in descending order.
A semicolon should not appear after the input table name.
The sorted table contains only the columns specified in the BY statement.
Which of the following statements selects from a table only those rows where the value of the Style column is RANCH, SPLIT, or TWOSTORY?
where Style='RANCH' or 'SPLIT' or 'TWOSTORY';
where Style in 'RANCH' or 'SPLIT' or 'TWOSTORY';
where Style in (RANCH, SPLIT, TWOSTORY);
where Style in ('RANCH', 'SPLIT', 'TWOSTORY');
Which of the following statements selects rows in which Amount is less than or equal to $5,000 or Rate equals 0.095?
where amount <= 5000 or rate=0.095;
where amount le 5000 or rate=0.095;
where amount <= 5000 or rate eq 0.095;
all of the above
Which statement creates the macro variable flower and assigns the value Plumeria?
%let flower=Plumeria;
%let flower="Plumeria";
%let &flower=Plumeria;
%let &flower="Plumeria";
Which statement in a PROC MEANS step enables you to specify the numeric columns to analyze?
TABLES
VARS
VAR
KEEP=
If you have a table that includes flower sales to all your retail outlets. You want to see the distinct values of Flower_Type with a count and percentage for each. Which procedure would you use?
MEANS
UNIVARIATE
FREQ
In which phase does the DATA step check for syntax errors?
compilation
execution
What statement is used to read a SAS data set in a DATA step?
DATA statement
WHERE statement
SET statement
assignment statement
To process an Excel file with the DATA step, you must first create a copy of the data as a SAS table.
True
False
What is the name of the output data set in the program below?
work.us
orion.sales
Country
sales
The data set orion.sales contains nine columns. Given this DATA step, how many columns does work.comp contain?
four
nine
five
Given the assignment statement below, what is the value of AvgExp for the observation that is shown?
6
8
. (missing value)
The statement generates a syntax error.
Which of the following SAS functions returns a number from 1 to 12?
YEAR(SAS-date-value)
MONTH(SAS-date-value)
WEEKDAY(SAS-date-value)
none of the above
In the program below, what is the value of Credit if Country is 'au'?
300
500
0
missing
What is the length of the Car_Type column created in this program?
6
7
8
Use a DO group in a DATA step when you want to execute multiple statements for a true IF-THEN expression.
True
False
If you run this program, which title or titles appear in the final PROC PRINT results?
The Top Line
The Top Line
The Next Line
The Top Line
The Second Line
The Top Line
The First Line
The Next Line
Which statement substitutes the value of the macro variable Year in the footnote?
footnote 'year Sales' ;
footnote '&year Sales' ;
footnote "%year Sales" ;
footnote "&year Sales" ;
Which statement is true based on the given program?
The column BatAvg will have a permanent label in the sashelp.baseballtable.
The label for BatAvg will appear in the PRINT report.
The label for BatAvg will appear in the MEANS report.
The label for BatAvg will appear in both reports.
Which statement is true regarding a BY statement in a reporting procedure such as PROC PRINT?
The BY statement is responsible for sorting the table.
Only one column can be specified in the BY statement.
The BY statement groups the report by the specified columns.
The BY statement must be the first statement after the PROC statement
Which statement is false concerning the FREQ procedure?
The NOPROCTITLE option can be placed in the PROC FREQ statement to remove the procedure title of The FREQ Procedure.
The ORDER=FREQ option can be placed in the PROC FREQ statement to display the column values in descending frequency count order.
The PLOTS= option can be placed in the TABLES statement after the forward slash to create bar charts based on counts or percentages.
The OUT= option can be placed in the TABLES statement after the forward slash to create a table containing counts and percentages.
Which PROC FREQ step creates the results shown here?
a
b
c
d
Which report is created from the following PROC FREQ step?
a
b
c
d
Which statement is true concerning the MEANS procedure?
The VAR statement is required and identifies the analysis columns.
The WAYS statement specifies the number of ways to make unique combinations of class columns.
The MAXDEC= option is used in the VAR statement to specify the number of decimal places for the statistics.
The COUNT and FREQ columns are automatically included in the output summary table that is produced by the OUT= option of the OUTPUT statement.
The input table must be pre-sorted by the columns listed in the CLASS statement of a PROC MEANS step.
True
False
Which statement from PROC MEANS contains valid syntax for creating a summary output table?
out=work.summary mean;
out work.summary mean(Weight)=TotW;
output out work.summary Weight=TotW;
output out=work.summary mean(Weight)=TotW;
Which statement is false concerning the options for the PROC EXPORT statement?
The DATA= option identifies the input SAS table.
The REPLACE option specifies to overwrite an existing file.
The DBMS= option specifies the database identifier for the type of file being created.
The OUT= option specifies the path and file name of the external data file being created.
Which PROC EXPORT step contains valid syntax?
proc export outfile="c:\temp\cars.txt" tab data=sashelp.cars replace; run;
proc export data=sashelp.cars dbms=csv outfile="c:\temp\cars.csv"; run;
proc export data=sashelp.class; dbms=csv; outfile="c:\temp\cars.csv"; run;
proc export dbms=tab data=sashelp.cars replace=yes outfile="c:\temp\cars.txt"; run;
What does the following program create?
two SAS tables: sales.q1_2018 and sales.q2_2018
two Excel workbooks: sales.q1_2018 and sales.q2_2018
two worksheets in the Excel workbook: midyear: q1_2018 and q2_2018
two worksheets in the Excel workbook: sales: q1_2018 and q2_2018
Which statement disassociates the sales libref?
libname sales xlsx 'c:\mydata\midyear.xlsx';
libname sales end;
libname sales clear;
libname sales close;
libname sales disassociate;
What type of output file does this program create?
SAS table
delimited file
Microsoft Excel XLS file
Microsoft Excel XLSX file
Which of these programs creates a Microsoft Excel file?
both
neither
Which of the following is not a valid ODS statement?
ods csvall file='c:\temp\myfile.csv';
ods pdf file='c:\temp\myfile.pdf';
ods powerpoint file='c:\temp\myfile.ppt';
ods word file='c:\temp\myfile.doc';
Which statement needs to be added to the end of this program?
ods clear;
ods close;
ods pdf clear;
ods pdf close;
Which statement is false concerning the options for the ODS statement?
The STYLE= option names the desired font.
The FILE= option specifies the output file to create.
The STARTPAGE= option controls the behavior of page breaks.
The PDFTOC= option controls the level of the expansion of the table of contents in PDF documents.
Which statement contains valid syntax for specifying a worksheet name?
ods excel sheet_name='Males';
ods excel (sheet_name='Males');
ods excel option(sheet_name='Males');
ods excel options(sheet_name='Males');
Which of the following SQL steps is written in the correct order?
from ...
select ...
where ...
order by
order by ...
from ..
select ..
where ..
select ...
where ...
order by ...
from ...
select ...
from ...
where ...
order by ...
Which of the following is false regarding the SQL procedure?
Column names are separated with commas.
The procedure ends with a QUIT statement.
Formats can be specified in the FROM clause.
The SELECT and FROM clauses are required in the SELECT statement.
Which syntax is valid for creating a computed column in the SELECT clause?
Ratio = Height/Weight
Ratio as Height/Weight
Height/Weight = Ratio
Height/Weight as Ratio
The SELECT statement creates a report. Which clause can be added before the SELECT clause to create a table?
create work.new =
create work.new table
create table work.new as
create table=work.new as
Which SELECT statement produces the given output?
Which SQL statement can delete tables?
DROP
VOID
DELETE
SELECT
If an inner join is performed on the following tables based on the ID and IDNO columns, how many rows will be in the PROC SQL report?
one
two
three
four
Which statement has the correct syntax for performing an inner join?
Which ON clause has valid qualifying syntax?
Which FROM clause is properly creating aliases?
from empsau=e inner join phonec= p
from empsau(e) inner join phonec(p)
from empsau as e inner join phonec as p
from empsau of e inner join phonec of p
SQL stands for ...
Structured Query Language
Standard Query Language
Statistical Query Language
Snake Quality Lemons
Command in a SQL step that deletes a table
KEEP
DELETE
DROP
RIP
A way to shorten the names of tables in a SQL step ..
CODENAME
NICKNAME
ALIAS
LIBNAME
"desc" is used after the column name in an "order by" statement to sort by descending order.
True
False
You need commas in the "select" statement of a SQL step to separate column names
True
False
Which of the following correctly creates a new column in a "select" statement inside a SQL step
newColumn = oldColumn + 2
oldColumn + 2 as newColumn
newColumn as oldColumn + 2
oldColumn + 2 = newColumn
Which of the following statements drops a table in a SQL step ...
drop table work.myclass
delete work.myclass
delete table work.myclass
remove table work.myclass
Which of the following correctly sets aliases?
from table1 alias a inner join table2 alias b
from table1(a) inner join table2(b)
from table1[a] inner join table2[b]
from table1 as a inner join table2 as b
Which of the following "on" statements will join data where the price columns are equal?
on table1.price > table2.price
on table1.price = table2.price
on table1.price == table2.price
on price = price
PROC SQL steps must end with a QUIT statement
True
False
Which statement is false concerning the compilation phase of the DATA step?
Initial values are assigned to the columns.
The program data vector (PDV) is created.
The DATA step is checked for syntax errors.
The descriptor portion of the output table is created.
Which statement is not a compile-time-only statement?
KEEP
LENGTH
SET
WHERE
Which statement is true concerning the execution phase of the DATA step?
Data is processed in the program data vector (PDV).
An implied OUTPUT occurs at the top of the DATA step.
An implied REINITIALIZE occurs at the bottom of the DATA step.
Columns read from the input table are set to missing when SAS returns to the top of the DATA step.
The DATA step debugger in SAS Enterprise Guide can be used with DATA and PROC steps.
True
False
Which PUTLOG statements create the following results in the SAS log?
putlog all; putlog Ratio;
putlog all; putlog Ratio=;
putlog all; putlog Ratio;
putlog all; putlog Ratio=;
How many rows and columns are in the output table ShippingZones given the following information?
5 rows and 3 columns
5 rows and 4 columns
10 rows and 3 columns
10 rows and 4 columns
The sashelp.cars table contains 428 rows: 123 rows with Origin equal to Europe and 305 rows with Origin equal to other values. How many rows will be in the Other table?
0
123
305
428
Which statement is false?
The KEEP statement names the columns to include from the input table.
The DROP statement names the columns to exclude from the output table.
The KEEP= option in the DATA statement names the columns to include in the output table.
The DROP= option in the SET statement names the columns to exclude from being read into the PDV.
Which columns are in the final table work.boots?
Subsidiary
Subsidiary and Total
Product and Subsidiary
Product, Subsidiary, Sales, and Inventory
What is the result of running the following DATA step?
The step produces work.boots with three columns.
The step produces work.boots with four columns.
The step produces an error due to invalid syntax for the KEEP= option.
The step produces an error because the Sales column is not read in from the sashelp.shoes table.
Which statement contains valid syntax for the RETAIN statement?
retain Year 2018;
retain Year*2018;
retain Year=2018;
retain Year{2018};
Which statement is false concerning the sum statement?
The sum statement ignores missing values.
The sum statement initially sets the accumulator column to missing.
The sum statements adds a numeric value to an accumulator column.
The sum statement automatically retains the value of the accumulating column.
What is the value of Count at the end of the third DATA step iteration?
. (missing)
60
130
160
What is the value of Count at the end of the third DATA step iteration?
. (missing)
20
30
70
Which step executes successfully without an error, given the input table sashelp.class?
Which statement is true given the following program?
The PDV contains a temporary variable named First.Name.
The output table work.student contains a column named Last.Name.
The DATA step sorts the input table by the column Name.
An error is produced because the BY statement is not permitted in the DATA step.
What are the correct values for First.Name and Last.Name if the value of Name appears only once in the input table?
First.Name=0 and Last.Name=0
First.Name=1 and Last.Name=1
First.Name=1 and Last.Name=0
First.Name=0 and Last.Name=1
Which DATA step statement indicates to continue processing the last row of a BY group?
if First.JobTitle;
if Last.JobTitle;
where First.JobTitle=1;
where Last.JobTitle=1;
Which statement needs to be added to the DATA step to reset the value of Total for each new BY group?
Total=0;
if Last.Region=0 then Total=0;
if First.Region=0 then Total=0;
if First.Region=1 then Total=0;
What are the values for First.City and Last.City for the third row of the input table given the following information?
First.City=0 and Last.City=0
First.City=1 and Last.City=0
First.City=0 and Last.City=1
First.City=1 and Last.City=1
Functions and CALL routines both return a value that must be used in an
assignment statement or expression.
True
False
Which function calculates the average of the columns Week1, Week2,
Week3, and Week4?
mean(Week1, Week4)
mean(Week1-Week4)
mean(of Week1, Week4)
mean(of Week1-Week4)
Which expression rounds each value of Sales to the nearest hundredth
(or two decimal places)?
round(Sales)
round(Sales, 2)
round(Sales, .01)
round(Sales, dollar10.2)
Which function could be used to remove the non-numeric symbols in
Phone?
COMPRESS
COMPBL
SCAN
FIND
Which statement reads CityCountry and correctly assigns a value to
Country?
Country=scan(CityCountry, 2);
Country=scan(CityCountry, -1);
Country=scan(CityCountry, 2, ',');
Country=scan(CityCountry, 2, ', ');
Which expression creates CityCountry?
cat(City, ", ", Country)
cats(", ", City, Country)
catx(City, ", ", Country)
catx(", ", City, Country)
How many rows are written to output based on the following statement?
0
1
3
5
Which of the following functions can convert the values of the numeric
variable Level to character values?
put(Level, 3.)
put(3., Level)
input(3., Level)
input(Level, 3.)
Which of the following functions converts the character values of Base to
numeric values?
put(comma10.2, Base)
put(Base, comma10.2)
input(Base, comma10.2)
input(comma10.2, Base)
Which step is not required when converting a character column named
Date to a numeric SAS date column with the same name?
Rename the Date column to a new name, such as CharDate.
Use the INPUT function to read the renamed CharDate character
column and create a numeric column named Date.
Specify an appropriate informat in the INPUT function.
Format the new numeric Date column.
Which of the following contains valid syntax?
value grades 'A'='Excellent' 'B'='Good';
value qtrfmt 1,2,3='First' 4,5,6='Second';
value $grades. 'A'='Excellent' 'B'='Good';
value qtrfmt '1'-'3'='First' '4'-'6'='Second';
What is the formatted value for the value of 100 given the following step?
low
medium
high
out of range
In the FORMAT procedure, you specify the name of the format and the name of the column that will use the custom format.
True
False
What is the correct formatted output given the following PROC FORMAT step and the input table?
Which of the following does not have proper syntax for specifying a range in the VALUE statement?
500>-700
500-<700
'A'-'C'
'Horse'-'Mouse'
Which statement is true concerning options for the FORMAT procedure?
The FMTLIB option goes in the SELECT statement.
The CNTLIN= option goes in the VALUE statement.
The FMTLIB option specifies the library to store the format.
The CNTLIN= option specifies a table from which formats are built.
Which columns are required in an input table to create a format based on numeric ranges?
FMTNAME, START, and LABEL
FORMAT, START, END, and NAME
FMTNAME, START, END, and LABEL
FORMAT, START, LAST, NAME, and TYPE
Which option in the PROC FORMAT statement specifies a library to store a custom format?
CATALOG=
FMTLIB=
LIBRARY=
STORE=
What is the default search order that is used to locate formats?
LIBRARY.FORMATS > WORK.FORMATS
SASHELP.FORMATS > LIBRARY.FORMATS
SASHELP.FORMATS > WORK.FORMATS
WORK.FORMATS > LIBRARY.FORMATS
Which of the following contains valid syntax for the FMTSEARCH= option?
options fmtsearch=sashelp;
options fmtsearch=sashelp.formats;
options fmtsearch=(sashelp sashelp.fmts);
options fmtsearch=[sashelp.fmts sashelp];
Which statement is true concerning concatenating tables?
All tables must have the same number of columns.
Columns in all tables must have matching names and lengths.
Tables must be in the same library.
Missing values are generated for columns that exist in one input table and not in another.
Which statement renames the existing column Location in work.travel as Destination?
set vacations(rename=(Location=Destination)) travel;
set vacations travel(rename=(Destination=Location));
set vacations travel(rename=(Location=Destination));
set vacations travel(rename(Destination=Location));
Which statement is true concerning merging with matching rows?
The MERGE statement must refer to temporary input tables.
The columns in the BY statement can be in only one of the tables.
Only two input tables can be specified in the MERGE statement.
The input tables must be sorted by the columns in the BY statement.
How many rows are in the both output table given the following input tables and code?
two
three
four
five
seven
How many rows are in the empsauc output table given the following input tables and code?
two
three
four
five
six
What is the result of the following step?
The table combine is created with four columns and five rows.
The step fails because the BY column ID is not properly sorted.
The step fails because Units is in both tables and not the BY column.
The step fails because of duplicate ID values within the donors1 table.
Which statement best describes the rows in the output table?
all the matching rows from both managers and staff
only the rows from managers that have no match in staff
only the rows from staff that have no match in managers
all the matching and nonmatching rows from both managers and staff
What are the values of C and A during the third iteration of the DATA step?
C=0 and A=0
C=1 and A=0
C=0 and A=1
C=1 and A=1
What is the value of Location in the output table?
Italy
France
Belgium
France Belgium Italy
Italy Belgium France
A single DATA step can be used to merge the following three tables:
True
False
Which output table does the following step produce?
Which statement is true regarding the iterative DO loop?
The start and stop values can be character or numeric values.
If an increment value is not specified, the default increment is 0.
The index column is incremented at the bottom of each DO loop.
The index column is not in the final table unless specifically kept.
How many rows are in the savings output table given the following input table and code? Note: Amount is a numeric column.
1
4
5
20
What is the final value of Year given the following step?
. (missing)
2010
2019
2020
Which of the following statements contains valid syntax?
do 1 to 10 by 2;
do while (Year>2025);
do until Earnings<=100000;
do date='01JAN2019' to '31JAN2019';
How many rows are in the bikeinfo2 output table given the following input table and code?
2
3
6
12
24
What is the value of x at the completion of the DATA step?
. (missing)
13
15
16
Which statement is false?
The DO UNTIL loop executes until a condition is true.
The DO WHILE loop always executes at least one time.
The DO WHILE loop checks the condition at the top of the loop.
The DO UNTIL loop checks the condition at the bottom of the loop.
Which of the following statements contains valid syntax?
do Age=10 to 14 and while (Weight<150);
do week=1 to 52 do until (Mileage ge 2750);
do Increase=5 to 10 while (temperature lt 102);
do Year=2018 to 2028 or until (Earnings<=100000);
Which output table does the following step produce?
Which is the better description for the following table?
wide table
narrow table
When using the DATA step to go from a wide table to a narrow table, which statement is needed for creating multiple rows from a single row?
WIDE
NARROW
RETAIN
OUTPUT
How many rows will be in the final table if work.airwide contains three rows?
3
6
9
12
When using the DATA step to go from a narrow table to a wide table, the KEEP statement is needed to hold values in the PDV across multiple iterations of the DATA step.
True
False
Which statement needs to be added to the DATA step to include only the last row per value of Year in the output table?
output;
if Last then output;
if Last.Year=1 then output;
if Last.Year=0 then output;
Which statement is false concerning the TRANSPOSE procedure?
Columns are transposed into rows.
By default, numeric columns are transposed.
Use a BY statement to sort the data while transposing.
Use a VAR statement to specify the character and numeric columns to transpose.
Which statements are needed in a PROC TRANSPOSE step for the following example (narrow to wide)?
Which statement or statements are needed in a PROC TRANSPOSE step for the following example (wide to narrow)?
by Day;
var Breakfast Lunch Dinner;
id Day;
id Day; var Breakfast Lunch Dinner;
Which option is needed in the PROC TRANSPOSE statement to rename the NAME column as shown in the output table?
name=
name=Meal
prefix=Meal
rename=Meal
Which option is needed in the PROC TRANSPOSE statement to rename the COL columns as shown in the output table?
out=meals2(COL1=Day7 COL2=Day1)
out=meals2(name=(COL1=Day7 COL2=Day1))
out=meals2(rename=(COL1=Day7 COL2=Day1))
out=meals2(prefix=(COL1=Day7 COL2=Day1))
