SAS Interview Practice Question With Answers
SAS Interview Practice Question With Answers
D. The value can not be determined as the program fails to execute due to errors.
Answer: C
Which one of the following statements is true regarding the SAS
automatic
_ERROR_ variable?
Answer: D
The following SAS program is submitted:
data work.totalsales (keep=monthsales{12});
set work.monthlysales (keep=year product sales); srray monthsales {12};
doi=1 to 12; monthsales{i}=sales; end;
run;
The data set named WORK.MONTHLYSALES has one observation per month for each of five
years for a total of 60 observations.
Which one of the following is the result of the above program?
Answer: D
A SAS program is submitted and the following SAS log is produced: 2 data gt100;
3 set ia.airplanes
4 if mpg gt 100 then output; 22 202
ERROR: File WORK.IF.DATA does not exist. ERROR: File WORK.MPG.DATA does not exist. ERROR: File
WORK.GT.DATA does not exist.
ERROR: File WORK.THEN.DATA does not exist. ERROR: File WORK.OUTPUT.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: a name,
a quoted string, (,;.END,KEY,KEYS,NOBS,OPEN,POINT,_DATA_,_LAST_,
_NULL_.
ERROR 202-322: The option or parameter is not recognized and will be ignored. 5 run;
The IA libref was previously assigned in this SAS session. Which one of the following corrects the errors in the
LOG?
Answer: B
The contents of the raw data file EMPLOYEE are listed below:
----|----10---|----20---|----30
Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44
The following SAS program is submitted: data test;
in file' employee';
input employee_ name $ 1-4;
if employee_ name = 'Ruthh' then input idnum 10-11; else input age 7-8;
run
Which one of the following values does the variable IDNUM contain when the name of the employee is
"Ruth"?
A. 11
B. 22
C. 32
D. . (missing numeric value) Answer: B
The following SAS program is submitted:
footnote1 'Sales Report for last Mounth'; footnote2 'Selected Products Only'; footnote3 'All
Regions';
footnote4 'All Figure in Thousands of Dollars'; proc print data = sasuser.shoes;
footnote2 'All products'; run;
Which one of the following contains the footnote text that is displayed in the report?
A. All Products
B. Sales Report for Last Month All Products
C. All Products All Regions
All Figures in Thousands of Dollars
D. Sales Report for Last Month All Products
All Regions
All Figures in Thousands of Dollars
Answer: B
Which one of the following SAS system options
prevents the page number from appearing on a
report?
A.NONUM
B.NOPAGE
C.NONUMBER
D.NOPAGENUM Answer: C
The following SAS program is submitted:
proc means data = sasuser.houses std mean max; varsqfeet;
run;
Which one of the following is needed to display the standard deviation with only
two decimal places?
Answer: A
Unless specified, which variables and data values are used to calculate statistics
in the MEANS procedure?
Answer: A
A realtor has two customers. One customer wants to view a list of homes selling for less than
$60,000. The other customer wants to view a list of homes selling for greater than $100,000.
Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will
select all desired observations?
Answer: B
The value 110700 is stored in a numeric variable.
Which one of the following SAS formats is used to
display the value as $110,700.00 in a report?
A. comma8.2
B. comma11.2
C. dollar8.2
D.dollar11.2
E.Answer D
The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a
permanenlabel of "Asking Price".
Which one of the following SAS programs temporarily replaces the label "Asking Price" with
the label "Sale Price" in the output?
Answer: C
The SAS data set BANKS is listed below:
BANKS
name rate FirstCapital0.0718 DirectBank0.0721 VirtualDirect0.0728
The following SAS program is submitted:
data newbank; do year = 1 to 3; set banks; capital + 5000; end;
run;
Which one of the following represents how many observations and variables
will exist in the SAS data set NEWBANK?
Answer: B
The following SAS program is submitted:
data work.clients; calls = 6;
do while (calls le 6); calls + 1;
end; run;
Which one of the following is the value of the variable CALLS in the
output data set?
A. 4
B. 5
C. 6
D. 7
Answer: D
The following SAS program is submitted:
data work.pieces; do while (n lt 6); n + 1;
end; run;
Which one of the following is the value of the variable N in the output data set?
A. 4
B. 5
C. 6
D. 7
Answer: C
The following SAS program is submitted:
A. 0
B. 1
C. 5
D. 60
Answer: B
A raw data record is listed below:
----|----10---|----20---|----30 1999/10/25
The following SAS program is submitted:
data projectduration; infile' file-specification'; input date $ 1 - 10;
<insert statement here> run;
Which one of the following statements completes the program above and
computes the duration of the project in days as of today's date?
Answer: C
A raw data file is listed below:
----|----10---|----20---|----30 1901 2
1905 1
1910 6
1925 .
1941 1
The following SAS program is submitted and references the raw data file above: data coins;
infile'file-specification'; input year quantity;
<insert statement(s) here> run;
Which one of the following completes the program and produces a non-missing value for the
variable TOTQUANTITY in the last observation of the output data set?
A. totquantity + quantity;
B. totquantity = sum(totquantity + quantity);
C. totquantity 0; sum totquantity;
D. retain totquantity 0;
totquantity = totquantity = quantity;
Answer: A
A raw data file is listed below:
----|----10---|----20---|----30
squash 1.10
apples 2.25
juice 1.69
The following SAS program is submitted using the raw data file above: data groceries;
infile'file-specification'; input item $ cost;
<insert statement(s) here>
Which one of the following completes the program and produces a grand total for all COST
values?
Answer: C
The following SAS program is submitted: data work.total;
set work.salary(kep = department wagerate);
by department;
if first.department then payroll = 0; payroll + wagerate;
if last.department; run;
The SAS data set WORK.SALARY, currently ordered by DEPARTMENT, contains 100
observations for each of 5 departments.
Which one of the following represents how many observations the WORK.TOTAL data set
contains?
A. 5
B. 20
C. 100
D. 500
Answer: A
The following SAS program is submitted:
data work.total;
set work.salary(kep = department wagerate); by department;
if first.department then payroll = 0; payroll + wagerate;
if last.department; run;
The SAS data set named WORK.SALARY contains 10 observations for each department,
currently ordered by DEPARTMENT.
Which one of the following is true regarding the program above?
Answer: C
The following SAS program is submitted:
libnamesasdata 'SAS-data-library'; data test;
set sasdata.chemists (keep = job_code); if job_code = 'chem3'
then description = 'Senior Chemist'; run;
The variable JOB_CODE is a character variable with a length of 6
bytes. Which one of the following is the length of the variable
DESCRIPTION in the output data set?
A. 6 bytes
B. 8 bytes
C. 14 bytes
D. 200 bytes
Answer: C
The following SAS program is submitted:
data work.passengers;
if OrigPassengers = . then OrigPassengers=100; TransPassengers= 100;
OrigPassengers= .; NonPaying= 10;
TotalPassengers= sum (OrigPassengers, TransPassengers); run;
Which one of the following is the value of the TOTALPASSENGERS
variable in the output data set?
A. 100
B. 110
C. 200
missing numeric value)
D. . (
Answer: A
The following SAS program is submitted:
data work.company;
set work.dept1(keep = jobcode) work.dept2(rename = (jcode =
jobcode)); run;
Which one of the following is the result?
Answer: B
Which one of the following SAS statements renames two variables?
A. set work.dept1
work.dept2(rename = (jcode = jobcode) (sal = salary));
B. set work.dept1
work.dept2(rename = (jcode = jobcode
sal = salary));
C. set work.dept1
work.dept2(rename = jcode = jobcode sal = salary);
D. set work.dept1 work.dept2(rename = (jcode jobcode) (sal salary));
Answer: B
The following SAS DATA step is submitted:
data work.accountting; set work.department; length jobcode$ 12; run;
The WORK.DEPARTMENT SAS data set contains a character variable named
JOBCODE with a length of 5.
Which one of the following is the length of the variable JOBCODE in the output
data set?
A. 5
B. 8
C. 12
D. The length can not be determined as the program fails to execute due to
errors.
Answer: A
The following SAS program is submitted:
data work.accounting;
set work.dept1 work.dept2; run;
A character variable named JOBCODE is contained in both the WORK.DEPT1
and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in
the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set.
Which one of the following is the length of the variable JOBCODE in the output
data set?
A. 5
B. 7
C. 8
D. 12
Answer: A
In the following SAS program, the input data files are sorted by the NAMES
variable:
libnametemp 'SAS-data-library'; data temp.sales;
merge temp.sales work.receipt;
by names; run;
Which one of the following results occurs when this program is submitted?
A. The program executes successfully and a temporary SAS data set is created.
B. The program executes successfully and a permanent SAS data set is created.
C. The program fails execution because the same SAS data set is referenced for
both read and write operations.
D. The program fails execution because the SAS data sets on the MERGE
statement are in two different libraries.
Answer: B
A raw data file is listed below: RANCH,1250,2,1,Sheppard Avenue,"$64,000"
SPLIT,1190,1,1,Rand Street,"$65,850" CONDO,1400,2,1.5,Market Street,"80,050"
TWOSTORY,1810,4,3,Garris Street,"$107,250" RANCH,1500,3,3,Kemble Avenue,"$86,650"
SPLIT,1615,4,3,West Drive,"94,450" SPLIT,1305,3,1.5,Graham Avenue,"$73,650"
The following SAS program is submitted using the raw data file as input: data
work.condo_ranch;
Which one of the following is the value of the variable named ITEM2 in the first observation of
the output data set?
A. table
B. ,table
C. . (missing numeric value)
D. ' ' (missing character value)
Answer: D
The following SAS program is submitted and reads 100 records
from a raw data file:
data work.total;
infile 'file-specification' end = eof; input name $ salary;
totsal+ salary;
<insert IF statement here> run;
Which one of the following IF statements writes the last observation
to the output data set?
A. if end = 0;
B. if eof = 0;
C. if end = 1;
D. if eof = 1; Answer: D
A raw data record is listed below:
----|----10---|----20---|----30
son,Travis,
The following output is desired:
relation firstname son Travis
Which one of the following SAS programs reads the data correctly?
A. data family / dlm = ','; infile 'file-specification'; input relation $ firstname $; run;
B. option dlm = ','; data family;
infile 'file-specification'; input relation $ firstname $; run;
C. data family;
infile 'file-specification' option dlm = ','; input relation $ firstname $;
run;
D. data family;
infile 'file-specification';
input relation $ firstname $ / dlm = ','; run;
Answer: C
The following SAS program is submitted:
proc print data = sasuser.houses; run;
<insert OPTIONS statement here> proc means data = sasuser.shoes;
run;
Which one of the following OPTIONS statements resets the page
number to 1 for the second report?
A. option pageno = 1;
B. option pagenum = 1;
C. options reset pageno = 1;
D. options reset pagenum = 1;
B. Answer: A
The following SAS program is submitted:
program is submitted:
libnamesasdata 'SAS-date-library'; data allobs;
set sasdata.banks; capital=0;
do year = 2000 to 2020 by 5; capital + ((capital+2000) * rate); output;
end;
How many observations will the ALLOBS data set contain?
A. 5
B. 15
C. 20
D. 25 Answer: D
The following SAS program is submitted:
data allobs;
set sasdata.origin (firstobs = 75 obs = 499); run;
The SAS data set SASDATA.ORIGIN contains 1000 observations. How
many observations does the ALLOBS data set contain?
A. 424
B. 425
C. 499
D. 1000
Answer: B
A raw data record is shown below:
07Jan2002
Which one of the following informats would read this value and store it
as a SAS date value?
A. date9.
B. ddmonyy9.
C. ddMMMyy9.
D. ddmmmyyyy9.
Answer: A
The following SAS program is submitted:? libnametemp 'SAS-data-library';
data work.new; set temp.jobs;
format newdate mmddyy10.; qdate= qtr(newdate);
ddate= weekday(newdate); run;
proc print data = work.new; run;
The variable NEWDATE contains the SAS date value for April 15, 2000. What
output is produced if April 15, 2000 falls on a Saturday?
A. Obs newdate qdate ddate 1 APR152000 2 6
B. Obs newdate qdate ddate 1 04/15/2000 2 6
C. Obs newdate qdate ddate 1 APR152000 2 7
D. Obs newdate qdate ddate 1 04/15/2000 2 7
Answer: D
The following SAS program is submitted:
data revenue; set year_1;
var1 = mdy(1,15,1960); run;
Which one of the following values does the variable named VAR1
contain?
A. 14
B. 15
C. 1151960
D. '1/15/1960'
Answer: A
The following SAS DATA step executes on Monday, April 25, 2000: data
newstaff;
set staff; start_date=today();
run;
Which one of the following is the value of the variable START_DATE in the
output data set?
A. a character string with the value '04/25/2000'
B. a character string with the value 'Monday, April 25, 2000'
C. the numeric value 14725, representing the SAS date for April 25, 2000
D. the numeric value 04252000, representing the SAS date for April 25, 2000
Answer: C