Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 20

1)

The following program is submitted,


Data numercards;
Infile file-specification;
Input @1 patient $15. relative $ 16-26 @;
If relative=children then
input @54 diagnosis $15. @;
else if relative=parents then
input @28 doctor $15.
Clinic $ 44-53
@54 diagnosis $15. @;
input age;
run;
How many raw data records are read during each iteration of the data step during execution?
A.
B.
C.
D.

1
2
3
4
JAGadish

Statistical Programmer I at PAREXEL


It is always one, only one record is read for every iteration.
Only one record is present in the PDV at every iteration. Once that record is moved from PDV to output dataset, again the datastep is
iterated and in compilation, the PDV has blank columns and in execution the values are added into the PDV, once all the columns are given
respective values, the record is moved to output dataset. This process will repeat depending upon the number of observation in the file to
be read

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)

The following program is submitted,


Data revenue;
Set year;
Var1=mdy(1,15,1960);
run;
Which one of the following values does the variable VAR1 contain?
A. 14
B. 15
C. 1151960
D. 1/15/1960
E.

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.

A program is submitted and the following log is produced;


2
3
4

data gt100;
set ia.airplanes
if mpg gt 100 then output;

ERROR: File WORK.IF.DATA dose 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.
5

Run;

The IA libref was previously assigned in this SAS session.


Which one of the following corrects the errors in the LOG?
A.
B.
C
D

Delete word THEN on the IF statement


Add a semicolon at the end of SET statement
Place quotes around value on IF statement
Add an END statement to conclude IF statement.

5)

A program is submitted and the following log is produced;


Data work.sets;
Do until(prod gt 6);
Prod + 1;
End;
Run;
Which one of the following is the value for variable PROD in the output dataset?
A.
B.
C
D

6)

5
6
7
8

The following program is submitted;


Data work.totalsales(keep=monthsales{12});
set work.monthlysales(keep=year product sales);
array monthsales{12};
do I=1 to 12;
monthsales(i)=sales;
end;
Run;
The data set name WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observation.
Which one of the following is the result of the above program?
A.
B.
C
D

7)

The program fails execution due to data errors.


The program fails execution due to syntax errors
The program executes with warning and create the WORK.TOTALSALES dataset
The program executes without warning and create the WORK.TOTALSALES dataset.

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;

The following program is submitted :


Data work.test;
First=Ipswich, England;
City_country=substr(first,1,7)||, ||England;
Run;
Which one of the following is the length for variable City_country in the output dataset?
A.
B.
C
D

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;

How many observations are produced by each proc?


A. 400 for proc print
4500 for proc means
B. 401 for proc print
4501 for proc means
C 401 for proc print
4500 for proc means
D 500 for proc print
5000 for proc means
10)

A raw data record is listed as below:


----|----10---|----20---|----30
1999/10/25
The following is submitted:
Data projectduration;
Infile file-specification;
Input date $ 1-10;
<insert statement here>
Run;
Which one complete the program above and computes the duration of the project in day as todays date?
A.
B.
C
D

11)

duration=today() put(date, mmddyy10.);


duration=today() put(date, yymmdd10.);
duration=today() input(date, ddmmyy10.);
duration=today() input(date, yymmdd10.);

Which one of the following ODS statement terminates output being written to an HTML file?
A.
B.
C
D

END
QUIT
STOP
CLOSE

12)

The following program is submitted :


Data work.test;
title=A title of Two Cities, Charles J. Dickens;
word=scan(title, 3, ,);
Run;
Which one of the following is the value of variable WORD in the output dataset?
A.
B.
C
D

13)

T
Of
Dickens
(missing character value)

The following program is submitted :


Proc datasets lib=sasuser;
Contents data=class varnum;
Quit;
Which one of the following is the purpose of the VARNUM option ?
A.
B.
C
D

14)

to print a list of variables names


to print the total number of variables
to print a list of variables in alphabetical order
to print a list of variables in the order they were created.

The following program is submitted :


Data work.January;
Set work.allmonths(keep=product month num_sold cost);
If month=Jan then output work.January;
Sales=cost*num_sold;
Keep=product sales;
Run;

Which variables does the dataset WORK.January contain?


A.
B.
C
D
15)

On which portion(s) of a SAS dataset does the PRINT procedure report?


A.
B.
C
D

16)

product and sales only


product, month, num_sold and cost only
product, sales, month, num_sold, and cost only
an incomplete output dataset is created due to syntax error.

the data portion only


the descriptor portion only
Both portions
Neither portion

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)

The following program is submitted :


Proc report data=work.houses nowd;
Column style price;
Where price < 100000;
<insert DEFINE statements here>
run;
The output look likes:
Style
Condo
Ranch

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)

The following program is submitted :


Data work.new;
Length word $7.;
Amount=7;
If amount=5 then word=CAT;
Else if amount=7 then word=DOG;
Else word=None!!!;
Amount=5;

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)

The following program is submitted :


Data test;
Set sasuser.employees;
If 2 le year_service le 10 then amount=1000;
Else if year_service gt 10 then amount=2000;
Else amount=0;
Amount_per_year=year_service/amount;
Run;
Which one does the variable Amount_per_year contains if an employee has been with the company for one year?
A.
B.
C
D

20)

0
1000
2000
. (missing numeric value)

The following program is submitted :


Libname company library-specification;
Proc sort data=company.payroll;
By employeeidnumber;
Run;

Which one represents how the records are sorted?


A. COMPANY.PAYROLL is recreated in sorted order of EMPLOYEIDNUMBER.
B. COMPANY.PAYROLL is stored in original order, and a new dataset PAYROLL is created in sorted order of
EMPLOYEIDNUMBER.
C COMPANY.PAYROLL is stored in original order, and a new dataset COMPANY.PAYROLLSORTED is created in sorted order of
EMPLOYEIDNUMBER.
D COMPANY.PAYROLL is recreated in sorted order of EMPLOYEIDNUMBER, and a new dataset PAYROLL is created in sorted
order of EMPLOYEIDNUMBER
21)

The following program is submitted :


Data sasdata.Atlanta sasdata.boston sasdata.Portland sasdata.phoenix;
Set company.prdsales;
If region=NE then output boston;
If region=SE then output Atlanta;
If region=SW then output phoenix;
If region=NW then output Portland;
Run;
Which one of the following is true ?
A.
B.
C
D

22)

no library references are required.


the datasets listed on all the IF statements requires a libref.
the datasets listed in the last two IF statement requires a libref.
the datasets listed in the first two IF statement requires a libref.

The following program is submitted :


Data work.clients;
Calls=6;
Do while (calls le 6);
Calls+1;
End;
Run;
Which one is the value for CALLS ?

A.
B.
C
D
23)

4
5
6
7

The output of PRINT procedure of dataset WORK.LEVELS is as follows:


Obs
1
2
3
4
5
6
7

name
Frank
John
Jui
Jose
Burt
Kelly
Juan

level
1
2
2
3
4
.
1

The following program is submitted:


Data work.expertise;
Set work.levels;
If level=. Then expertise=Unknown;
Else if level=1 then expertise=Low;
Else if level=2 then expertise=Medium;
Else expertise=High;
Run;
Which one of the following does the variable EXPERTISE contains?
A.
B.
C
D
24)

Low, Medium, High


Low, Medium, Unknown
Low, Medium, High, Unknown
Low, Medium, High, Unknown, and (missing character value)

The following program is submitted :


Data work.empsalary;

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

The following program is submitted :


Libname sasdata library reference;
Data test;
Set sasdata.chemist(keep=job_code);
If job_code=chem3 then description=Senior Chemist;
Run;
Variable JOB_CODE is a character variable with a length of 6 bytes.
Which one is the length of variable DESCRIPTION?
A.
B.
C
D

26)

6
8
14
200

The following program is submitted :


Data work.month;
Date=input(12MAR2003,date9.);
Run;

Which one represents the type and length of DATE?


A.
B.
C
D
27)

numeric, 8 bytes
numeric, 9 bytes
character, 8 bytes
character, 9 bytes

The following program is submitted :


Proc sort data=sasuser.houses out=report;
By style;
Run;
In which library is the output dataset stored?
A.
B.
C
D

28)

work
report
houses
sasuser

The following program is submitted :


Data work.passengers;
If origpassengers=. Then origpassengers=100;
Transpassengers=100;
Origpassengers=.;
Nonpaying=10;
TotalPassengers=OrigPassengers + Transpassengers;
Run;
Which one is the value for TOTALPASSENGERS?
A.
B.
C
D

100
110
200
. (missing numeric value)

29)

The following program is submitted :


Data work.flights;
destination=CPH;
select(destination);
when (LHR) city=London;
when (CPH) city=Copenhagen;
otherwise city=Other;
end;
Run;
Which one is the value for CITY?
A.
B.
C
D

30)

Other
Copenh
Copenhagen
(missing character value)

The following program is submitted:


Options pageno=1;
Proc print data=sasuser.houses;
Run;
Proc means data=sasuser.shoes;
Run;
The report created by PRINT procedure generates 5 pages of output.
Which is the page number on the first page generated by MEANS procedure?
A.
B.
C
D

31)

1
2
5
6

The following program is submitted :

Proc sort data=work.employee;


By descending fname;
Proc sort data=work.salary;
By descending fname;
Data work.empdata;
Merge work.employee work.salary;
By fname;
Run;
Which one explains why the program failed execution?
A.
B.
C
D
32)

The sort procedure contains syntax error.


The merge data sets are not permanent SAS dataset
The datasets were not merged in the order by which they were sorted
The RUN statement were omitted after each of the sort procedure

SAS dataset EMPLOYEE_INFO is listed below:


ID Number
2542
2543
4521
3282

Expense
100.00
132.15
234.14
111.12

The following program is submitted:


Proc sort data=employee_info;
<insert BY statement here>
Run;
Which one complete the program and sorts the data sequentially by descending expense values within each descending ID number
value?
A.
B.
C
D

By descending Idnumber Expense;


By (Idnumber Expense) descending;
By Idnumber descending Expense descending;
By descending Idnumber descending Expense;

33)

The following program is submitted :


Data work.accounting;
Set work.dept1 work.dept2;
Run;
A character variable named JOBCODE exists in both datasets. It has a length of 5 in WORK.DEPT1 and length of 7 in
WORK.DEPT2
Which one is the length of JOBCODE in the output dataset?
A.
B.
C
D

34)

5
7
8
12

The following program is submitted :


Data work.staff;
Jobcategory=FA;
Joblevel=1;
Jobcategory=jobcategory||joblevel;
Run;
Which is the value for Jobcategory in the output dataset?
A.
B.
C
D

35)

FA
FA1
FA 1
(missing character value)

Which one is true of RETAIN statement in SAS data step?


A. It can be used to assign an initial value to _N_
B. it is only valid in conjunction with a SUM function
C It has no effect on variables read with the SET, MERGE, and UPDATE statements.

D
36)

It adds the value of an expression to an accumulate variable and ignores the missing values

The following program is submitted :


<Insert ODS statement here>
proc means data=sasuser.shoes;
where product in (Sandal,Slipper,Boot);
Run;
Which ODS statement complete the program and generate an HTML file?
A.
B.
C
D

ODS html=sales.html;
ODS file=sales.html;
ODS file html=sales.html;
ODS html file=sales.html;

You might also like