SAS Test Revised
SAS Test Revised
SAS Test Revised
8. 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;
9. The contents of two SAS data sets named EMPLOYEE and SALARY are listed
below: write a code which gives you the detailed description of data and
descriptor portion for a data set in sas ?
data emplsal;
merge employee (in=ine) salary(in=ins);
by name;
if ine and ins;
run;
11. Which one of the following is true of the SUM statement in a SAS DATA step
program?
o It does not retain the accumulator variable value from one iteration of the
SAS DATA step to the next.
o It adds the value of an expression to an accumulator variable and ignores
missing values.
o It is not valid with the SET, MERGE and UPDATE statements.
o It is only valid in conjunction with a SUM function.
12. SAS date values are the number of days since which date
a. Jan 1, 1900
b. Jan 1, 1950
c. Jan 1, 1960
d. Jan 1, 1970
13. An input date file has date expression in the form 10222001. Which SAS informat
should you use to read dates?
a. DATE6.
b. DATE8.
c. MMDDYY6.
d. MMDDYY8.
14. Which SAS statement repetitively executes several statements while the value of
cholesterol is greater than 200?
a. do cholesterol>200
b. do cholesterol gt 200
c. do while (cholesterol>200);
d. do while cholesterol>200;
15. If you submit the following program, which variables appear in the new data set?
a. none
b. weight
c. age, group
d. age, weight, group
16. which statement identifies the name of a raw data file to be read with the fileref
products and specifies the data step read only records 1-15?
a. infile products obs 15;
b. infile products obs = 15;
c. input products obs = 15;
d. input products 1-15;
17. Suppose you run a SAS program that causes three data step errors. What is the
value of the automatic variable _error_ when the observation that contains the
third error is processed?
a. 0
b. 1
c. 2
d. 3
18. Based on the input statement in the data step below, in what order will the variables
be stored in the new data set?
Data perm.update;
Infile invent;
Input idnum $ 15-19 item $ 1-13 instock 21-22 backord 24-25;
Total = instock + backord;
Run;
a. idnum item instock baclord total
b. item idnum instock backord total
c. total idnum item instock backord
d. total item idnum instock backord
19. There are two data sets. First data set has variables name, age. Second data set has
variables name, age and date. What happens if you merge the two data sets by
variable name?
a. The values f age in the first data set overwrite the values of age in the second data
set.
b. The values of age in the second data set overwrite the values of age in the first data
set.
C. The DATA step fails because the two data sets contain same named variables that
have different values
d. The values of age in the second data set are set to missing.
a. under 6
b. under 60
c. over 60
d. Missing character value
26. In a data step, how can you reference a temporary SAS data set named forecast?
a. forecast
b. work.forecast
c. sales.forecast
d. both a and b
28. What is the difference between an informat and a format? Name three informats or
formats.
29. How do you create library in SAS ?What is the difference between temporary library
and permanent library?
30. Which option in the PROC IMPORT procedure overwrites an existing file?
A. NEW
B. OVERWRITE
C. REPLACE
D. KEEP