Question 1
Question
Which of the following statements correctly describes a delimited raw data file? Select all that apply.
Answer
-
It is external to SAS.
-
It is not software-specific.
-
The values are arranged in columns.
-
The values are separated by spaces or other characters.
-
The values are labeled with field names.
Question 2
Question
Suppose you want to write a DATA step that reads a raw data file. Do you need to use a LIBNAME statement to assign a libref to the directory in which the raw data file is stored?
Question 3
Question
Which of the following statements is true?
Answer
-
a. SAS creates an input buffer only if reading data from a raw data file.
-
At compile time, the PDV holds the variable name, type, length, and initial value.
-
The descriptor portion of the data set is the first item that SAS creates during the compilation phase
Question 4
Question
Which statement is true of a DATA step when reading from a raw data file?
Answer
-
a. SAS reads data from the raw data file into the PDV.
-
The size of the input buffer adjusts automatically based on the length of the input record.
-
At the bottom of the DATA step, SAS writes the contents of the PDV to the output SAS data set.
Question 5
Question
Which of the LENGTH statements below creates the character variable SalesRep with a length of 18?
Answer
-
length $ SalesRep 18;
-
length SalesRep 18;
-
length SalesRep $ 18;
-
length SalesRep=18;
Question 6
Question
Which of the DATA steps below creates the variable SalesRep with a length of 18?
Answer
-
data work.mydata;
infile 'filepath/sales.csv';
length SalesRep $ 18;
input Amount SalesRep $ Customer $;
run;
-
data work.mydata;
infile 'filepath/sales.csv'
input Amount SalesRep $ Customer $;
length SalesRep $ 18;
run;
Question 7
Question
Which of these statements is not true about a SAS informat?
Answer
-
A SAS informat provides instructions for reading nonstandard values.
-
A SAS informat provides a length for character variables.
-
A SAS informat must include a period.
-
A SAS informat controls the way nonstandard data values are stored in a SAS data set.
-
A SAS informat must include a numeric value to specify the width of the input field.
Question 8
Question
Which of the following DATA steps correctly reads instream data as input for the data set?
Answer
-
data work.mydata;
input Amount SalesRep $ Customer $;
datalines;
250.35 Phelps Torres
178.50 Deng Horekova
;
-
data work.mydata;
datalines;
250.35 Phelps Torres
178.50 Deng Horekova
input Amount SalesRep $ Customer $;
;
Question 9
Question
What does SAS do when it encounters a data error in a raw data record? Select all that apply.
Answer
-
prints a ruler and the raw data record in the SAS log
-
stops processing the program
-
assigns a missing value to the variable that the invalid data affects
-
prints a note about the error in the SAS log
-
rints the variable values in the corresponding SAS observation in the SAS log
Question 10
Question
By default, SAS creates character variables with a length of _____ bytes for list input.
Question 11
Question
Which of the following values can SAS store, without truncation, in a character variable that has a length of 8 bytes?
Answer
-
Sales Manager
-
Regional Manager
-
12036578
-
$123,293.50
-
06/15/2008
Question 12
Question
To explicitly define the length of a variable read from a raw data file, you use a LENGTH statement after the INPUT statement in a DATA step.
Question 13
Question
Which of the following statements specifies instream data, or the lines of data that you enter directly in a DATA step?
Answer
-
DATALINES
-
INFILE
-
INPUT
-
INSTREAM
Question 14
Question
Which of the following statements cannot be used in a DATA step that reads a raw data file as input?
Answer
-
a. KEEP
-
b. IF
-
c. FORMAT
-
d. WHERE
Question 15
Question
Which of the following can determine the length of a new variable?
Question 16
Question
Which of the following SAS functions returns a number from 1 to 12?
Answer
-
YEAR(SAS-date)
-
MONTH(SAS-date)
-
WEEKDAY(SAS-date)
-
TODAY(SAS-date)
Question 17
Question
An ELSE statement must immediately follow the IF-THEN statement in your program, and it executes only if the previous IF-THEN statement is true.
Question 18
Question
Which DATA step ensures that all observations are assigned a nonmissing value for Bonus?
Question 19
Question
Which of the following statements assigns the value pass to the variable Grade when the variable Points is greater than or equal to 70?
Answer
-
if Points=70 then Grade='pass';
-
if Grade>=70 then Points='pass';
-
if Points>=70 then Grade=pass;
-
if Points>=70 then Grade='pass';
Question 20
Question
Use a DO group in a DATA step when you want to execute multiple statements for a true IF-THEN expression.
Question 21
Question
Which SET statement has correct syntax?
Answer
-
set empscn(rename(Country=Location))
empsjp(rename(Region=Location));
-
set empscn(rename=(Country=Location))
empsjp(rename=(Region=Location));
-
set empscn rename=(Country=Location)
empsjp rename=(Region=Location);
Question 22
Question
Which of the following statements is true about merging SAS data sets by using the DATA step?
Answer
-
Merging combines observations from two or more data sets into a single observation in a new data set.
-
SAS can merge data sets based on the position of observations in the original data set or by the values of one or more common variables.
-
Match-merging is merging by values of one or more common variables.
-
To match-merge data sets, all input data sets must be sorted or indexed on the BY variables.
-
All of the above
Question 23
Question
Which of the following programs concatenates the data sets, sales and products, in that order?
Answer
-
data newsales;
set products sales;
run;
-
data newsales;
set sales products;
run;
-
data newsales;
set sales;
set products;
run;
Question 24
Question
If you run this DATA step, what observations does the data set bonuses contain?
data bonuses;
merge managers staff;
by EmpID;
run;
Answer
-
all of the observations from managers, and only those observations from staff with matching values for EmpID
-
all of the observations from staff, and only those observations from managers with matching values for EmpID
-
all observations from staff and all observations from managers, whether or not they have matching values
-
only those observations from staff and manager with matching values for EmpID
Question 25
Question
What is the syntax error in this DATA step?
data returns_qtr1;
set returns_jan(rename=(ID=CustID)
(Return=Item))
returns_feb(rename=(Dt=Date))
returns_mar;
run;
Answer
-
You cannot specify more than two data sets in the SET statement.
-
There are too many sets of parentheses in the RENAME= option.
-
You cannot specify multiple variables in the RENAME= option.
-
The BY statement is missing.
Question 26
Question
If you run this DATA step, what observations does the data set bonuses contain?
data bonuses;
merge managers (in=M)
staff (in=S);
by EmpID;
if M=0 and S=1;
run;
Answer
-
only the observations from staff that have no match in managers
-
only the observations from managers that have no match in staff
-
all observations from both managers and staff, whether or not they match
-
no observations
Question 27
Question
What change was needed in the TABLES statement?
proc freq data=orion.sales;
tables Country nocum nopercent;
run;
Answer
-
comma between NOCUM and NOPERCENT
-
forward slash before the TABLES statement options
-
an equals sign after the TABLES statement variable
-
none of the above
Question 28
Question
PROC UNIVARIATE identified two observations with Salary values less than 24000. What procedure can you use to display the observations containing the invalid values?
Answer
-
PROC MEANS
-
PROC PRINT
-
PROC FREQ
Question 29
Question
Which of these procedures produces output that is most useful for detecting duplicate values?
Answer
-
PROC PRINT
-
PROC FREQ
-
PROC MEANS
-
PROC UNIVARIATE
Question 30
Question
Which of these programs is most useful for determining the exact observation that contains a numeric variable with an extreme value?
Answer
-
proc print data=sales.totals;
var ProdNum Sales Region;
run;
-
proc freq data=sales.totals;
tables ProdNum Sales Region;
run;
-
proc univariate data=sales.totals;
run;
Question 31
Question
A PROC FREQ analysis identified invalid and missing values in a data set. Which of these procedures can display the observations that contain invalid or missing values?
Answer
-
PROC PRINT
-
PROC FREQ
-
PROC MEANS
-
PROC UNIVARIATE
Question 32
Question
This PROC MEANS step creates all of the statistics listed below.
proc means data=orion.sales;
run;
minimum and maximum
the total number of observations that PROC MEANS processes for each subgroup (N Obs)
mean and standard deviation
the number of nonmissing values (N)
Question 33
Question
Which option enables you to specify the number of extreme observations displayed by PROC UNIVARIATE?
Answer
-
a. NEXTROBS=
-
b. NLEVELS
-
c. NOPRINT
-
_ALL_
Question 34
Question
In a PROC FREQ step, you can use user-defined formats, as well as existing SAS formats, to group data.
Question 35
Question
Is there a problem with this program?
ods pdf file="filepath/myreport.pdf";
proc print data=orion.sales;
run;
ods close;
Question 36
Question
Which program correctly opens and closes the LISTING destination?
Answer
-
ods;
proc freq data=orion.staff;
tables Manager_ID;
run;
ods close;
-
ods listing;
proc freq data=orion.staff;
tables Manager_ID;
run;
ods listing close;
-
ods destination;
proc freq data=orion.staff;
tables Manager_ID;
run;
ods destination close;
Question 37
Question
The SAS data set orion.growth contains 6 observations and 3 variables (Department, Total_Employees, and Increase). How many observations and variables will the forecast data set contain?
data forecast;
set orion.growth;
TotalYear1=Total_Employees*(1+Increase);
run;
Answer
-
6 observations, 4 variables
-
6 observations, 3 variables
-
12 observations, 4 variables
Question 38
Question
If you submit the code shown here, what happens if the value of Country is canada?
data northamerica asia check;
set salesdata;
select(Country);
when ("US","CANADA","MEXICO") output northamerica;
when ("JAPAN") output asia;
otherwise output;
end;
run;
Answer
-
Nothing happens because the value does not match any value listed in a WHEN expression.
-
The observation is written only to the check data set.
-
The observation is written to all three output data sets
Question 39
Question
Which of the following programs correctly assigns values of Bonus based on values of Promotion?
Answer
-
select;
when (2) Bonus=Salary*.6;
end;
-
select (Promotion);
when (Promotion=2) Bonus=Salary*.6;
end;
-
select (Promotion);
when (2) Bonus=Salary*.6;
end;
Question 40
Question
The data set employee_addresses has 9 variables. After this code runs, how many variables will there be in the usa data set?
data usa(keep=Employee_Name City State) australia other;
set orion.employee_addresses;
if Country='US' then output usa;
else if Country='AU' then output australia;
else output other;
run;
Question 41
Question
The SAS data set car has the variables CarID, CarType, Miles, and Gallons. Select the DATA step or steps that creates the ratings data set with the variables CarType and MPG. Select all that apply.
Question 42
Question
Which program reads data from observation 100 to observation 200 and prints 50 observations?
Question 43
Question
Which DATA step creates Mth2Dte as an accumulating variable with an initial value of 50?
Question 44
Question
What must happen in the DATA step to summarize data by groups? Select all that apply.
Answer
-
Sort the input data.
-
Set the accumulating variable to its initial value at the start of each BY group.
-
Increment the accumulating variable.
-
Output only the last observation of each BY group.
Question 45
Question
Which DATA step creates Mth2Dte as an accumulating variable with an initial value of 0?
Question 46
Question
Which statement retains the value of Sales2Dte in the PDV across iterations of the DATA step?
Answer
-
Total_Retail_Price+Sales2Dte;
-
Sales2Dte+Total_Retail_Price;
-
Sales2Dte=Sales2Dte+Total_Retail_Price;
Question 47
Question
Is this statement true? To create an accumulating total for a group, you first have to sort the data by the grouping variable(s)
Question 48
Question
Which statement is true about the following program?
data payroll.empmast;
set payroll.employee;
by gender jobcode;
run;
Answer
-
A change in the value of LAST.JobCode causes the value of LAST.Gender to change.
-
A change in the value of LAST.Gender causes the value of LAST.JobCode to be set to 1.
-
Both LAST.JobCode and LAST.Gender are stored in the new data set.
Question 49
Question
Which statement is false about BY-group processing when you use the BY statement with the SET statement?
Answer
-
The data sets listed in the SET statement must be indexed or sorted by the values of the BY variable(s).
-
The DATA step automatically creates two new variables, FIRST. and LAST., for each variable in the BY statement
-
The FIRST. and LAST. variables identify the first and last observation in each BY group, respectively.
-
The FIRST. and LAST. variables have values of 0 when SAS is processing an observation with the first occurrence of a new value for those variables, and a value of 1 for the other observations.
Question 50
Question
If you process a BY group that consists of a single observation, what are the correct values of FIRST.BY-variable and LAST.BY-variable?
Answer
-
FIRST.BY-variable=0 LAST.BY-variable=0
-
FIRST.BY-variable=1 LAST.BY-variable=0
-
FIRST.BY-variable=1 LAST.BY-variable=1
-
FIRST.BY-variable=0 LAST.BY-variable=1
Question 51
Question
When using the DATA step to summarize grouped data, what is the first step in the process?
Answer
-
Output the first observation of each BY group.
-
Set the accumulating variable to zero at the start of each BY group.
-
Increment the accumulating variable with a sum statement (automatically retains).
Question 52
Question
Which DATA step statement indicates to continue processing the last observation of a BY group?
Question 53
Question
Which raw data value below is an example of nonstandard numeric data?
Answer
-
234.908
-
-234.908
-
$234,908.00
-
23E4
Question 54
Question
Can you use column input to read both standard and nonstandard data in fixed fields?
Question 55
Question
Which informat below should you use to read the raw data value $1,230,456 as a numeric variable?
Question 56
Question
Which set of instructions reads the values for Quantity (in the third field) after the values for Item (in the first field)? Select all that apply.
Answer
-
input Item $9. @20 Quantity 3.;
-
input Item $9. +10 Quantity 3.;
-
input Item $9. +11 Quantity 3.;
Question 57
Question
Which INPUT statement correctly reads the values for Fname, Lname, Address, City, State, and Zip in order?
Answer
-
input Fname $ Lname $ /
Address $20. /
City $ State $ Zip $;
-
input Fname $ Lname $ /;
Address $20. /;
City $ State $ Zip $;
-
input / Fname $ Lname $
/ Address $20.
City $ State $ Zip $;
Question 58
Question
Which style of INPUT statement specification is used to read data in fixed columns?
Answer
-
column input
-
formatted input
-
a and b
-
none of the above
Question 59
Question
In the INPUT statement, what is the syntax used to move the input pointer to a specified column?
Question 60
Question
The width of the input field can be specified by an informat when used with formatted input.
Question 61
Question
Formatted input cannot be used to read which of the following types of raw data?
Answer
-
. standard free-format data
-
standard data in fixed fields
-
nonstandard data in fixed fields
Question 62
Question
Which set of instructions does not correctly read the values for Quantity (in the third field) after the values for Item (in the first field)?
Answer
-
input Item $9. @20 Quantity 3.;
-
input Item $9. +10 Quantity 3.;
-
. input Item $9. +11 Quantity 3.;
Question 63
Question
Which of the following INPUT statements correctly reads the values for Fname (in the second field), Lname, Department, and Salary (in that order)?
Question 64
Question
The single trailing @ releases a record when which of the following conditions occurs?
Question 65
Question
What does a forward slash (/) indicate when used in an INPUT statement?
Answer
-
Load the next file in the input buffer.
-
Load the next field in the input buffer.
-
Load the next record in the input buffer.
-
none of the above
Question 66
Question
When you use a trailing @, which of the following things occur?
Answer
-
The pointer position does not change.
-
No new record is loaded into the input buffer.
-
The next INPUT statement for the same iteration of the DATA step continues to read the same record.
-
All of the above
Question 67
Question
Generally, the most efficient place to put a subsetting IF statement is as early as possible in the DATA step
Question 68
Question
Which of the following statements is false?
Answer
-
Functions are used in SAS statements.
-
A function is written by specifying the function name followed by the function arguments.
-
. Function arguments must be enclosed in parentheses.
-
All function arguments are variables.
Question 69
Question
Which assignment statement converts the current value of Name to the new value of Name? Select all that apply
Answer
-
. propcase(Name,'*');
-
propcase(Name,' *');
-
propcase(Name,'* ');
Question 70
Question
If you specify the period, comma, and blank as delimiters for the SCAN function, what is the fourth word in the text string below?
MR. JONATHAN E. MATTHEWS, PERSONNEL DIRECTOR
Answer
-
E
-
PERSONNEL DIRECTOR
-
MATTHEWS
-
PERSONNEL
Question 71
Question
If you specify the colon as the delimiter for the SCAN function, how many words appear in the text string below?
Washington:New York:California:New Mexico
Question 72
Question
In this DATA step, which SCAN function completes the assignment statement to correctly extract the four-digit year from the Text variable? Select all that apply.
data Scan_Quiz;
Text="New Year's Day, January 1st, 2007";
Year=________________________;
run;
Answer
-
scan(Text,-1)
-
scan(Text,6)
-
scan(Text,6,', ')
Question 73
Question
Which of the following FIND functions returns the value 1?
Answer
-
find('She sells seashells? Yes, she does.','she')
-
find('She sells seashells? Yes, she does.','she','i')
-
find('She sells seashells? Yes, she does.','she',22)
-
find('She sells seashells? Yes, she does.','she',-10)
Question 74
Question
Select the statement that replaces the first three characters in values of Dept with the characters PUR.
Answer
-
Dept=substr(PUR,1,3);
-
substr(Dept,1,3)='PUR';
-
PUR=substr(Dept,1,3);
-
none of these
Question 75
Question
Select the assignment statement that changes the string Burma to Myanmar in values of the variable Country. Assume that Country has a length of 25 bytes.
Answer
-
Country=tranwrd('Burma','Myanmar');
-
Country=tranwrd(Country,Burma,Myanmar);
-
Country=tranwrd(Country,'Burma','Myanmar');
Question 76
Question
Which of the following assignment statements correctly calculates the average of Rest1, Rest2, Rest3, and Rest4?
Answer
-
RestAvg=mean of Rest1-Rest4;
-
RestAvg=mean(Rest1 Rest2 Rest3 Rest4);
-
RestAvg=sum(Rest1,Rest2,Rest3,Rest4);
-
RestAvg=mean(Rest1,Rest2,Rest3,Rest4);
Question 77
Question
Which program changes the values of the variable Examples, found in the data set Before, to the values shown in After?
Question 78
Question
Which statement correctly describes the result of submitting the DATA step that is shown below? The variables TotalPay and Commission are numeric. The variable Pay is character.
data reg.newsales;
set reg.sales;
TotalPay=Pay+Commission;
run;
Answer
-
The values of the numeric variables TotalPay and Commission are converted to character values because these variables are used in a character context.
-
The values of the character variable Pay are converted to numeric values because this variable is used in a numeric context.
Question 79
Question
A typical value for the character variable Target is 123,456. Which statement correctly converts the values of Target to numeric values when creating the variable TargetNo?
Answer
-
TargetNo=input(Target,comma6.);
-
TargetNo=input(Target,comma7.);
-
TargetNo=put(Target,comma6.);
-
TargetNo=put(Target,comma7.);
Question 80
Question
Which function calculates the average of the variables Var1, Var2, Var3, and Var4?
Answer
-
a. mean(Var1,Var4)
-
b. mean(Var1-Var4)
-
c. mean(of Var1,Var4)
-
d. mean(of Var1-Var4)
Question 81
Question
Which assignment statement for Total correctly uses a SAS variable list and the SUM function to add the values for Year1, Year2, Year3, and Year4?
Question 82
Question
Which function returns the greatest integer less than or equal to the argument?
Question 83
Question
Which value is returned from the following statement?
x=int(7.89)
Question 84
Question
If the value of PctDec is -3.272, which statement will NOT return a value of -3 for Decrease?
Question 85
Question
Within the data set hrd.temp, PayRate is a character variable and Hours is a numeric variable. What happens when the following program is submitted?
data temp;
set hrd.temp;
Salary=PayRate*Hours;
run;
Answer
-
SAS converts the values of PayRate to numeric values. No message is written to the log.
-
SAS converts the values of PayRate to numeric values. A message is written to the log.
-
SAS converts the values of Hours to character values. A message is written to the log.
Question 86
Question
Which of the following functions can convert the values of the numeric variable Level to character values?
Answer
-
put(Level,3.)
-
input(3.,Level)
-
put(3.,Level)
-
input(Level,3.)
Question 87
Question
A typical value for the numeric variable SiteNum is 12.3. Which statement correctly converts the values of SiteNum to character values when creating the variable Location?
Answer
-
Location=Dept||'/'||put(SiteNum, $3);
-
Location=Dept||'/'||put(SiteNum,4);
-
Location=Dept||'/'||put(SiteNum,3.1);
-
Location=Dept||'/'||put(SiteNum,4.1);
Question 88
Question
Which of the following functions converts the character values of Base to numeric values?
Answer
-
put(comma10.2,Base)
-
put(Base,comma10.2)
-
input(Base,comma10.2)
-
input(comma10.2, Base)
Question 89
Question
AvgSale=input(AvgSale,comma6.);
Question 90
Question
Which of the following represents acceptable syntax for the PUTLOG statement. Select all that apply.
Answer
-
putlog 'customer'=;
-
putlog 'Note: write this in the log';
-
putlog write this in the log;
-
putlog customer $quote13.;
-
putlog customer=;
Question 91
Question
What will this PUTLOG statement do?
Answer
-
write text to the log
-
write the values of all the variables to the log
-
write formatted values to the log
-
write all the logic errors to the log
Question 92
Question
Which of the following represents acceptable syntax for the END= option in the INFILE statement?
Question 93
Question
Is it acceptable to use the END= option in both SET and INFILE statements?
Question 94
Question
When a logic error occurs, SAS writes an error message to the log.
Question 95
Question
Which of the following is not a task of the PUTLOG statement?
Answer
-
Write text to the log.
-
Write formatted values to the log.
-
Write all the logic errors to the log.
-
Write the values of all the variables to the log.
Question 96
Question
The variable Title is 22 characters long. One of the values for Title is My House on the Lane. Which of the following statements would provide the full value of the variable in the log if the data included two leading spaces?
Answer
-
putlog Title $quote20.;
-
putlog Title $quote22.;
-
putlog Title $quote30.;
Question 97
Question
The END= option in the SET or INFILE statement indicates that SAS should process the last observation.
Question 98
Question
When you submit the following program, what will be listed in the log?
data work.holdings;
set work.catalog end=last;
if _n_=1 then
putlog 'books';
if last then do;
putlog 'last of books';
putlog _all_;
end;
run;
Answer
-
Books, last of books, and the values of all the variables for the last observation
-
Books, last of books, and the values for all the variables in all observations
-
The values of all the variables for the last observation
Question 99
Question
Select the DO WHILE statement that would generate the same result as the program below.
data work.invest;
Capital=100000;
do until(Capital gt 500000);
Year+1;
Capital+(Capital*.10);
end;
run;
Answer
-
do while(Capital ge 500000);
-
do while(Capital=500000);
-
do while(Capital le 500000);
-
do while(Capital>500000);
Question 100
Question
How many times does this DO loop execute?
data work.test;
x=15;
do while(x<12);
x+1;
end;
run;
Question 101
Question
What is the value of X at the completion of the DATA step?
data work.test;
x=15;
do while(x<12);
x+1;
end;
run;
Question 102
Question
In the example below, the variable X is summed during each iteration of the DO loop. What is the value of X at the completion of this DATA step?
data test;
do i=1 to 5;
do j=1 to 4;
x+1;
end;
end;
run;
Question 103
Question
Which statement is false regarding nested DO loops?
Answer
-
Each DO statement must have a corresponding END statement.
-
Each DO loop must have its own index variable.
-
Each DO loop must use the same increment value.
-
Each DO loop can contain iterated SAS statements.
Question 104
Question
During each execution of the following DO loop, the value of Earned is calculated and is added to its previous value. How many times does this DO loop execute?
data finance.earnings;
Amount=1000;
Rate=.075/12;
do Month=1 to 12;
Earned+(Amount+Earned)*Rate;
end;
run;
Question 105
Question
In the data set invest, what would be the stored value for Year?
data invest;
do Year=2008 to 2012;
Capital+5000;
Capital+(Capital*.03);
end;
run;
Question 106
Question
What is the value of X at the completion of the DATA step?
data test;
x=15;
do while(x>12);
x+1;
end;
run;
Question 107
Question
In the following DATA step, how many times does the inner DO loop execute?
data invest;
do Year=2008 to 2012;
Capital+5000;
do Quarter=1 to 4;
Capital+(Capital*.03);
end;
end;
run;
Question 108
Question
Based on this DATA step, how many observations will the earnings data set contain?
data earnings;
Earned=0;
do Count=1 to 12;
Earned+(Amount+Earned)*(Rate/12);
output;
end;
run;
Question 109
Question
Which of the following statements will not execute a DO loop?
Answer
-
do i=8, 10, 4, 14;
-
do i=.30 to .20 by -.1;
-
do i=(x+10) to x;
-
do i=-1 to -3 by -1;
Question 110
Question
How many times does the DO loop execute for the first iteration of the DATA step?
Question 111
Question
How many times does this DO loop execute?
data test;
x=15;
do until(x>12);
x+1;
end;
run;
Question 112
Question
What is the value of X at the completion of the DATA step?
data test;
x=15;
do until(x>12);
x+1;
end;
run;
Question 113
Question
Which statement about SAS arrays is true?
Answer
-
When you create an array in one DATA step, you can reference it by name in another DATA step.
-
An array can contain a mixture of numeric and character variables if they are explicitly named.
-
An array exists only for the duration of the DATA step.
-
It is a good practice to name the array the same name as one of the variables in the array
Question 114
Question
Which of the following ARRAY statements is correct?
Question 115
Question
The trial data set contains five numeric variables that store data collected during an experimental trial. Which ARRAY statement groups the variables T1, T2, T3, T4, and T5 into an array named test?
Question 116
Question
Which DO loop completes the program so that the values stored in the variables Weight1-Weight8 are converted from kilograms to pounds?
data hrd.convert;
set hrd.fitclass;
array wt{*} Weight1-Weight8;
___________
__________
___________
run;
Answer
-
do i=1 to 8;
wt{i}=wt{i}*2.2046;
end;
-
do i=1 to *;
wt[i]=wt[i]*2.2046;
end;
-
do i=1 to 8;
Weight{i}=Weight{i}*2.2046;
end;
Question 117
Question
Which ARRAY statement creates the numeric variables Comp1 through Comp25? Select all that apply.
Question 118
Question
Which ARRAY statement correctly defines a temporary lookup table named country with three elements that are initialized to AU, NZ, and US?
Answer
-
array country{3} _temporary_ ('AU','NZ','US');
-
array country{3} $ 2 _temporary_ (AU,NZ,US);
-
array country{3} $ 2 _temporary_ ('AU','NZ','US');
Question 119
Question
Which statement is false regarding an ARRAY statement?
Answer
-
It is an executable statement.
-
It can be used to create variables.
-
It must contain either all numeric or all character elements.
-
It must be used to define an array before the array name can be referenced.
Question 120
Question
What belongs within the braces of this ARRAY statement?
array contrib{?} qtr1-qtr4;
Question 121
Question
Which of the following ARRAY statements is correct?
Answer
-
array grades{*} Q1 Q4 Q7 Q8 Q12 Q15;
-
array sites{3} $10;
-
array trials{*} _numeric_;
-
array exp{5} _temporary_ (93 85 77 69 61);
-
All of the above
Question 122
Question
What does the following ARRAY statement do?
array seed{*} _character_;
Answer
-
This statement creates a temporary array of character variables.
-
This statement creates an array of all previously defined character variables in the DATA step.
-
Nothing. This is not an accurate ARRAY statement.
Question 123
Question
For the program below, select the interative DO statement that processes all elements in the contrib array.
data work.contrib;
array contrib{4} qtr1-qtr4;
_____________
contrib{i}=contrib{i}*1.25;
end;
run;
Answer
-
do i=4;
-
do i=1 to 4;
-
do until i=4;
-
do while i le 4;
Question 124
Question
What is the value of the index variable that references Jul in the statements below?
array quarter{4} Jan Apr Jul Oct;
do i=1 to 4;
yeargoal=quarter{i}*1.2;
end;
Question 125
Question
Which statement below is false regarding the use of arrays to create variables?
Answer
-
The variables are added to the program data vector during the compilation of the DATA step.
-
You do not need to specify the array elements in the ARRAY statement.
-
By default, all character variables are assigned a length of eight.
-
Only character variables can be created.
Question 126
Question
Which of these data sets could be described as a narrow data set?
Question 127
Question
Which data set is more appropriate for using PROC FREQ to determine the number of donations made in each of the four quarters?
Question 128
Question
When using an array to restructure the data, how many array elements would you use if you wanted work.a to look like work.b?
Question 129
Question
Which of the following IF statements creates the non-matches seen in the combine data set?
Question 130
Question
What are the names of the two temporary variables created by the BY statement in the code below?
data orderdata(keep=Customer_Name Quantity Total_Retail_Price)
noorders(keep=Customer_Name Birth_Date);
merge orion.customer
work.orders_2007(in=order);
by Customer_ID;
if order=1 then output orderdata;
else output noorders;
run;
Answer
-
FIRST.Order, LAST.Order
-
FIRST.Customer, LAST.Customer
-
FIRST.Customer_ID, LAST.Customer_ID
Question 131
Question
Which statements correctly access the Supplier worksheet in the Excel workbook?
Question 132
Question
Which statement is true concerning match-merging?
Answer
-
The MERGE statement must refer to permanent data sets.
-
The variables in the BY statement can be in only one of the data sets.
-
Only two data sets can be specified in the MERGE statement.
-
When you use the MERGE statement with the BY statement, the data must be sorted or indexed on the BY variable.
Question 133
Question
Which of the following data set options can be added to the MERGE statement to help identify data set contributors (that is, identify the matches)?
Answer
-
IN=
-
OBS=
-
RENAME=
-
MATCHES=
Question 134
Question
The following program will execute without errors:
data bonuses;
merge managers(in=M)
staff(in=S);
by EmpID;
if M=0 and S=1;
run;;
Question 135
Question
Which subsetting IF statement selects observations for subsequent processing only if all three input data sets contribute to the current observation?
data merged.flowers;
merge spring.roses(rename=(red=BrickRed) in=yellow)
spring.lilacs(in=purple)
spring.petunias(in=pink);
by ID;
_________________________
run;
Answer
-
if yellow=1 and purple=1 or pink=1;
-
if yellow=0 or purple=0 or pink=0;
-
if yellow=1 and purple=1 and pink=1;
-
if yellow=1 or purple=1 and pink=0;
Question 136
Question
The following program will execute without errors:
Question 137
Question
The following tables list the variables in three SAS data sets: a, b, and c. Can these three data sets be merged in one DATA step?
Question 138
Question
Which of the following LIBNAME statements correctly assigns the libref mymusic to the file AllMusic.xls, which is stored in the Entertainment directory of the C: drive on the Windows operating environment?
Answer
-
libname mymusic 'Allmusic.xls';
-
libname mymusic 'C:\Entertainment\Allmusic.xls';
-
libname mymusic 'C:\Entertainment\Allmusic';
-
libname mymusic 'C:\Entertainment\Allmusic' filetype='excel';
Question 139
Question
The data sets ensemble.spring and ensemble.summer both contain a variable named Blue, and Blue is not the BY variable. Which program prevents the values of the variable Blue from being overwritten when you merge the two data sets?
Answer
-
data ensemble.merged;
merge ensemble.spring(keep=blue)
ensemble.summer;
by fabric;
run;
-
data ensemble.merged;
merge ensemble.spring(blue=navy)
ensemble.summer;
by fabric;
run;
-
data ensemble.merged;
merge ensemble.spring(rename=(blue=navy))
ensemble.summer;
by fabric;
run;
Question 140
Question
The variable Location appears in the three data sets represented below. Which value appears in the output data set when the three data sets are merged in the order shown?
Answer
-
. Florida
-
Canada
-
New York
Question 141
Question
Suppose the empinfo.bonuses data set contains the variables ID, Name, Office, Manager, Location, and Amount. Specify a data set option in the MERGE statement below to use only the variables ID, Name, and Amount in the data set.
data mergedata.emppay;
merge sales.reps(rename=(office=OfficeNumber))
empinfo.sales
empinfo.bonuses ___________________;
by ID;
run;
Answer
-
(drop=ID Name Amount)
-
(output ID Name Amount)
-
(keep=ID Name Amount)
-
(in=ID Name Amount)
Question 142
Question
The control data set that you use to create a format must contain variables that supply the same information as which of the following statements?
Answer
-
assignment
-
VALUE
-
INPUT
-
FORMAT
Question 143
Question
SAS stores formats as entries in which of the following?
Answer
-
SAS data sets
-
the SAS registry
-
SAS catalogs
-
SAS programs
Question 144
Question
Which of the following PROC FORMAT steps creates a format from the temporary data set citycode and saves the format to sasuser.formats?
Answer
-
proc format lib=work cntlin=sasuser.citycode;
run;
-
proc format lib=sasuser cntlin=citycode;
run;
-
proc format lib=work cntlin=citycode;
run;
Question 145
Question
Given the following OPTIONS statement, in what order will SAS search to find a user-defined format?
options fmtsearch=(rpt prod.newfmt);
Answer
-
work.formats→library.Prod→library.Newfmt
-
work.formats→library.formats→rpt.Formats→prod.Newfmt
-
rpt.Formats→prod.Newfmt→work.formats→library.formats
Question 146
Question
Given the following PROC FORMAT step, select the OPTIONS statement to submit before SAS can use the region format.
proc format lib=sasuser;
value region
1='North'
2='South'
3='East'
4='West'
run;
Question 147
Question
By default, the FMTERR system option is in effect. If you use a format that SAS cannot load, SAS issues an error message and stops processing the step.
Question 148
Question
Which of the following statements can you add to this PROC FORMAT step to document all of the formats in the sasuser.formats catalog except the $geoarea and geopop formats?
proc format lib=sasuser fmtlib;
___________________________
run;
Question 149
Question
Which option do you use with PROC FORMAT to document the format in a particular format catalog?
Answer
-
FMTSEARCH=
-
FMTERR
-
CATALOG
-
FMTLIB
Question 150
Question
Which PROC FORMAT option do you use to create a SAS data set from a format?
Answer
-
. CNTLIN=
-
LIBRARY=
-
CNTLOUT=
-
FMTLIB=
Question 151
Question
By default, user-defined formats are stored in a temporary catalog named work.formats and are deleted at the end of your SAS session.
Question 152
Question
Which PROC FORMAT statement option is used to create a permanent format?
Answer
-
CNTLIN=
-
FMTLIB=
-
LIBRARY=
-
CNTLOUT=
Question 153
Question
The variables FmtName, Start, and Label are required in order to create a format from an input control data set.
Question 154
Question
Given the following OPTIONS statement, in what order will SAS search to find a user-defined format?
options fmtsearch=(orion.MyFmts);
Answer
-
orion.MyFmts only
-
work.formats→orion.MyFmts→library.formats
-
work.formats→library.formats→orion.MyFmts
-
orion.MyFmts→work.formats→library.formats
Question 155
Question
Which statement best describes the purpose of the output control data set?
Answer
-
The output control data set enables you to output one value for one observation that contains the information about the format.
-
The output control data set enables you to output formats without writing VALUE statement in the PROC FORMAT step.
-
The output control data set contains information that describes formats. It is the data set that is created with the CNTLIN= option in the PROC FORMAT statement.
-
The output control data set contains information that describes formats. It is the data set that is created with the CNTLOUT= option in the PROC FORMAT statement.
Question 156
Question
When the NOFMTERR system option is in effect, what happens when SAS encounters a format it can't locate?
Answer
-
SAS creates the format in the default work.formats directory and continues processing.
-
SAS substitutes the $w. or w. format and continues processing.
-
SAS stops processing and writes an error message to the log.
-
SAS skips processing at that step and continues with the next step, and writes a note to the log.
Question 157
Question
Which statement is true concerning the FMTLIB option in PROC FORMAT when generating a report for permanent formats?
Answer
-
The FMTLIB option in PROC FORMAT prints information about all permanent formats in your SAS session.
-
The FMTLIB option in PROC FORMAT prints information about all of the formats in the work.formats catalog.
-
The FMTLIB option in PROC FORMAT prints information about all of the formats in the LIBRARY.FORMATS option.
-
The FMTLIB option in PROC FORMAT prints information about all formats in the catalog that is specified in the LIBRARY= option.
Question 158
Question
Which procedure enables you to manage a SAS catalog?
Answer
-
PROC COPY
-
PROC CATMOD
-
PROC CATALOG
-
PROC CONTENTS
Question 159
Question
In which location can you not use a FORMAT?
Answer
-
PUT statement
-
TITLE statement
-
FORMAT= option
-
FORMAT statement
Question 160
Question
Which value statement correctly creates a nested format definition?
Question 161
Question
Which statement about PROC SQL is false?
Answer
-
PROC SQL stops running only when SAS encounters a QUIT statement.
-
A PROC SQL step can contain more than one SELECT statement.
-
A PROC SQL step creates a report by default.
-
When you use PROC SQL to join tables, you do not need to presort the input tables
Question 162
Question
Which code creates a report that displays two columns from orion.donate? (Assume that the orion library is already defined.)
Answer
-
proc sql;
from orion.donate
select Employee_ID, Amount;
quit;
-
proc sql;
select Employee_ID, Amount
from orion.donate;
quit;
-
proc sql;
select Employee_ID Amount
from orion.donate;
quit;
-
proc sql;
select Employee_ID, Amount;
from orion.donate;
quit;
Question 163
Question
Which PROC SQL step creates only an output table named clinic.bills?
Answer
-
proc sql;
create table clinic.bills;
select ID, Date, Fee
from clinic.admit;
quit;
-
proc sql;
create table clinic.bills as
select ID, Date, Fee
from clinic.admit;
quit;
-
proc sql;
select ID, Date, Fee
from clinic.admit
create table as clinic.bills;
quit;
Question 164
Question
The tables Orion.customer and orion.country both store country abbreviations in a column named Country. The other columns have unique names. In a PROC SQL step, which SELECT statement correctly joins the two tables on matching values of Country?
Answer
-
select Customer_ID, Country, Country_Name
from orion.customer, orion.country
where Country = Country;
-
select Customer_ID, Country, Country_Name
from orion.customer, orion.country
where customer.Country = country.Country;
-
select Customer_ID, customer.Country, Country_Name
from orion.customer, orion.country
where country.Country = customer.Country;
Question 165
Question
This PROC SQL step joins two tables that have only the column Student_Name in common. Which FROM clause correctly completes this step? Select all that apply.
proc sql;
select r.Student_Name,
Course_Number,
Balance
___________________
where r.Student_Name=
s.Student_Name;
quit;
Answer
-
from school.register as r,
school.students as s
-
from school.register as r,
school.students s
-
from school.students as s,
school.register as r
-
from school.students as
s.students,
school.register as
r.register
Question 166
Question
PROC SQL stops running when it encounters which of the following?
Question 167
Question
In this PROC SQL step, which clause or clauses are written incorrectly?
proc sql;
select Employee_ID
Name
Dependents
from orion.employees
where Salary < 50000;
quit;
Question 168
Question
When you are joining tables using PROC SQL, you never use a WHERE clause.
Question 169
Question
Which code fragment correctly completes the WHERE clause in this PROC SQL step joining the two tables by Policy?
proc sql;
select claims.Policy,
Claim_Num,
Dependents
from insurance.claims
insurance.accounts
where _______________=
_______________;
quit;
Answer
-
Policy=Policy
-
claims.Policy=accounts.Policy
-
claims.Policy=insurance.Policy
-
insurance.Policy=insurance.Policy
Question 170
Question
In the SELECT statement, when is a WHERE clause required?
Question 171
Question
Airline.expenses and airline.revenue both have 30 rows, and one column in common named Flight_ID. Each row in the first table has a value of Flight_ID that matches the Flight_ID value in one and only one row in the second table. When you run this PROC SQL program, how many rows appear in the result set?
proc sql;
select expenses.Flight_ID,
Amount, Date
from airline.expenses,
airline.revenue;
quit;
Question 172
Question
The tables orion.orders and orion.customers have the common column Customer_ID. What output does this program generate?
proc sql;
select Order_ID,
Customer_ID,
Order_Type
from orion.orders;
select Customer_ID,
Customer_Age_Group,
Order_Type
from orion.customers;
quit;
Answer
-
no output
-
one report that contains a Cartesian product
-
two reports that contain query results
-
two reports and two output data sets
Question 173
Question
Will this PROC SQL step run?
proc sql;
select SaleDate
from company.sales
where SaleAmt>500;
quit;
Question 174
Question
The table insurance.claims contains the columns Policy, Claim_Num, and Status. The table insurance.accounts also contains the column Policy. These two tables are not sorted. Will this PROC SQL step create a report?
proc sql;
select accounts.Policy,
Claim_Num,
Status
from insurance.claims,
insurance.accounts
where accounts.Policy =
claims.Policy;
quit;
Answer
-
Yes
-
No, because the FROM clause lists the tables in the wrong order.
-
No, because the input tables were not sorted first.
-
No, because some of the columns in the SELECT clause are not qualified.
-
No, because this program creates an output table instead of a report.
Question 175
Question
Which code fragment completes the FROM clause in this PROC SQL step?
proc sql;
select x.Policy,
Claim_Num,
Status
from insurance.claims ___
insurance.accounts x
where x.Policy =
y.Policy;
quit;
Question 176
Question
Which of the following statements about the SAS macro facility are true?
Answer
-
The SAS macro facility enables you to package text into units that have names.
-
The SAS macro facility enables you to improve your efficiency as a SAS programmer.
-
The SAS macro facility includes its own language, which is called the SAS macro language.
-
All of the above
Question 177
Question
Which of the following statements is true about macro variables?
Answer
-
SAS assigns names and values to automatic macro variables; the programmer assigns names and values to user-defined macro variables.
-
Neither automatic nor user-defined macro variables are part of a SAS data set.
-
Both automatic and user-defined macro variables can only have values that are text strings.
-
All of the above
Question 178
Question
Which of the following macro variable references will the macro processor correctly interpret? Select all that apply.
Answer
-
proc print data=mydata;
where sales >= &total;
run;
-
proc print data=&mydata;
run;
-
title 'Totals for &Month';
proc print data=mydata;
run;
Question 179
Question
What is the value and length of the macro variable fname, based on the %LET statement shown below?
%let fname= Marie
Question 180
Question
What is the value and length of the macro variable name, based on the %LET statement shown below?
%let name="Marie Hudson";
Question 181
Question
What is the value and length of the macro variable total, based on the %LET statement shown below?
%let total=10+2;
Question 182
Question
Which of the following statements or programs does not correctly display the value of the macro variable month to the SAS log?
Answer
-
options &month;
proc print data=&month;
run;
-
%put &month;
-
options symbolgen;
proc print data=&month;
run
-
%put the macro variable Month has the value &month;
Question 183
Question
What does the SAS macro facility include?
Answer
-
a. the SAS macro compiler
-
b. the SAS macro processor
-
c. the SAS macro debugger
-
d. the SAS macro language
-
b and d
Question 184
Question
What is the benefit of using the SAS macro facility?
Answer
-
The SAS macro facility enables you to reduce the amount of text you must enter in your programs
-
The SAS macro facility enables you to write programs that are easily modified and customized.
-
The SAS macro facility enable you to automatically reference system information in your programs.
-
all of the above
Question 185
Question
Which statement correctly defines a SAS macro variable?
Answer
-
A SAS macro variable is a data set variable whose value depends on the observation that is being processed.
-
A SAS macro variable is independent of a SAS data set and contains a text string. The value of the macro variable remains constant until you change it.
Question 186
Question
Which program correctly references the automatic macro variable SYSDATE?
Answer
-
title "June Totals as of &sysdate"; data sales.juntot; set sales.total; if month=6 and year=2008; run;
-
title "June Totals as of sysdate"; data sales.juntot; set sales.juntot; if month=6 and year=2008; run;
Question 187
Question
Which of the following statements creates a macro variable named rate that has a value of 23?
Answer
-
let rate="23";
-
&let rate=23;
-
%let rate=23;
-
%let rate="23";
Question 188
Question
What is the value of the macro variable rate after this statement is processed?
%let rate=4+3;
Question 189
Question
What is the result of including the following line in your program?
options symbolgen;
Answer
-
Messages about macro variable resolution are listed in the program output.
-
Messages about macro variable resolution are suppressed in the program output
-
Messages about macro variable resolution are written to the SAS log.
-
Messages about macro variable resolution are suppressed in the SAS log.
Question 190
Question
Which assignment statement sets the value of Day to a text string that contains the day of the week that the current SAS session began?
Answer
-
Day=sysday;
-
Day=&sysday;
-
Day='&sysday';
-
Day="&sysday";
Question 191
Question
. When you submit a program that includes references to macro variables, when does SAS replace those references with macro variable values?
Answer
-
before compilation of the program
-
during compilation of the program
-
after compilation but before execution of the program
-
during execution of the program
Question 192
Question
Which of the following is NOT a valid name for a user-defined macro variable?
Answer
-
month
-
_year
-
sysver
-
total_sales
Question 193
Question
Which of the following lists the steps in the programming process correctly?
Answer
-
a.
1. Write a SAS program.
2. Debug or modify.
3. Run the program.
4. Review the results.
5. Define the business need.
-
b.
1. Define the business need.
2. Write a SAS program.
3. Run the program.
4. Review the results.
5. Debug or modify.
Question 194
Question
Are raw data files created only by SAS?
Question 195
Question
Using SAS, you can read many kinds of data.
Question 196
Question
What does a SAS program file contain?
Question 197
Question
Are SAS data sets created only by SAS?
Question 198
Question
Can a SAS program be saved and reused?
Question 199
Question
How many step boundaries does this program contain?
data work.staff;
length First_Name $ 12
Last_Name $ 18
Job_Title $ 25;
infile "&path/newemployees.csv" dlm=',';
input First_Name $ Last_Name$
Job_Title $ Salary;
run;
proc print data=work.staff;
run;
proc means data=work.staff;
var Salary;
run;
Question 200
Question
Which of the following is a SAS syntax requirement?
Answer
-
Begin each statement in column one.
-
Put only one statement on each line.
-
Separate each step with a line space.
-
End each statement with a semicolon.
-
Put a RUN statement after every DATA or PROC step.