Professional Documents
Culture Documents
Sample Exam For Sas Base
Sample Exam For Sas Base
1
2
3
4
JAGadish
E. data numrecords;
F. 48 infile 'file-specification';
G. 49 input @1 patient $15. relative $ 16-26 @;
H. 50 if relative = 'children' then input @54 diagnosis $15. @;
I.
51 else if relative = 'parents' then input @28 doctor $15. clinic $ 44-53 @54 diagnosis $15. @;
J.
52 input age;
K. 53 datalines;
L.
M. NOTE: The data set WORK.NUMRECORDS has 3 observations and 6 variables.
N. NOTE: DATA statement used (Total process time):
O.
real time
0.03 seconds
P.
cpu time
0.01 seconds
Q.
R. 57 ;
S. 58 run;
T. File:
U. Mike Edwards parents
V. ketty Perry
children
W. Jones Mark
parents
Sara Patrik
Russel pete
Russel pete
clinic1 cancer
clinic3 cancer
clinic3 cancer
23
25
35
X. Data Set(s):
Y. Commentary:
The statement input @1 patient $15. relative $ 16-26 @; is using the @ symbol at the end. An INPUT statement
with this 'at' sign (@) at the end is called a 'trailing at'. This tells SAS to hold that line of raw data. While the trailing @
holds that line, you can test the observation with an IF statement to see if it is one you want to keep. If it is, then you
can read data for the remaining variables with a second INPUT statement.
Z. The values for variables doctor and clinic are only read by SAS when the condition for statement else if relative =
'parents' then is TRUE. Here, in each iteration one raw data record will be read by SAS so option A is correct.
2)
F.
Set(s):
Commentary:
In the statement var1 = mdy(1,15,1960);, MDY() is a SAS function which returns a SAS date value from month, day
and year values. Since day 0 in SAS is 1/1/1960, this day (1/15/1960) is number 14. For more information please refer
to the link below:
3)
The contents of the raw data file PRODUCT are listed below
----|----10---|----20---|----30
24613 $25.31
The following program submitted:
Date inventory;
Infile file-specification;
Input idnum 5. @10 price;
run;
Which one of the following statement is the value of the PRICE variable?
A.
B.
C.
D.
4)
25.31
$25.31
. (Missing numeric value)
No value is stored as the program fails to execute due to errors.
data gt100;
set ia.airplanes
if mpg gt 100 then output;
Run;
5)
6)
5
6
7
8
7)
The following program is submitted and read 100 records from raw data file :
Data work.total;
Infile file-specification end=eof;
Input name $ salary ;
Total + salary;
<Insert IF statement here>
Run;
Which one of the following IF statement write the last observation to the output dataset?
A.
B.
C
D
8)
If end=0;
If eof=0;
If end=1;
If eof=1;
9)
6
7
17
25
When the following program is submitted, dataset SASDATA.PRDSALES contains 5000 records:
Libname sasdata SAS-data-library;
Options obs=500;
Proc print data= sasdata.prdsales(firstobs=100);
Options obs=max;
Proc means data=sasdata.prdsales(firstobs=500);
Run;
11)
Which one of the following ODS statement terminates output being written to an HTML file?
A.
B.
C
D
END
QUIT
STOP
CLOSE
12)
13)
T
Of
Dickens
(missing character value)
14)
16)
The content of the raw data file EMPLOYEE are listed below:
----|----10---|----20---|----30
ruth 39 11
jose 32 22
Sue 30 33
John40 44
The following program is submitted:
Data test;
Infile Employee;
Input employee_name $ 1-4;
If employee_name =ruth then input idnum 10 11;
Else input age 7-8;
Run;
Which one does the variable IDNUM contains when the name of the employee is ruth?
A.
B.
C
D
11
22
33
. (missing numeric value)
17)
price
80,050
79,350
64,000
86,650
Which one of the following completes the program and generate the output?
A. define style/display width=9;
define price/sum format=comma9. width=10;
B. define style/width=9;
define price/sum format=comm9. width=10;
C define style/group width=9;
Define price/sum format=comma9. width=10;
D define style/order width=9;
Define price/sum format=comma9. width=10;
18)
run;
Which one represents the values of AMOUNT and WORK variables?
A.
Amount
5
B. Amount
5
C Amount
7
D Amount
7
19)
word
DOG
word
CAT
word
DOG
word
(missing character value)
20)
0
1000
2000
. (missing numeric value)
22)
A.
B.
C
D
23)
4
5
6
7
name
Frank
John
Jui
Jose
Burt
Kelly
Juan
level
1
2
2
3
4
.
1
Set work.people(in=inemp)
Work.money(in=insal);
If insal and inemp;
Run;
Work.people has 5 obs, work.money has 7 obs.
How many observation will the dataset WORK.EMPSALARY contain?
A.
B.
C
D
25)
0
5
7
12
26)
6
8
14
200
numeric, 8 bytes
numeric, 9 bytes
character, 8 bytes
character, 9 bytes
28)
work
report
houses
sasuser
100
110
200
. (missing numeric value)
29)
30)
Other
Copenh
Copenhagen
(missing character value)
31)
1
2
5
6
Expense
100.00
132.15
234.14
111.12
33)
34)
5
7
8
12
35)
FA
FA1
FA 1
(missing character value)
D
36)
It adds the value of an expression to an accumulate variable and ignores the missing values
ODS html=sales.html;
ODS file=sales.html;
ODS file html=sales.html;
ODS html file=sales.html;