Академический Документы
Профессиональный Документы
Культура Документы
Answer : e
5.) Given the following code and data values:
data temp;
merge X1 X2;
by ID;
run;
X1 DATASET
X2 DATASET
ID
1
2
ID
1
1
2
2
NAME
ALISON
KEVIN
CLASS
A
B
B
A
d.) Susheel
Answer: b
7.) data _null_;
put Susheel;
run;
After execution of the data step above, where will the value from the put statement be written?
a.)
In Last file opened
b.)
In dataset _null_
c.)
Syntax error
d.)
Log
Answer: d
8.) What is true about _ERROR_ variable?
a.)
Can be used in assignments/calculation in a datastep.
b.)
This variable appears in the output dataset
c.)
Will have values YES or NO
d.)
Will have values TRUE or FALSE
Answer: a
9.) What is true about array variables?
a.)
They are temporary variables created in a datastep.
b.)
They are output in a dataset.
c.)
Can contain numeric and character values at same time.
d.)
Cannot be used in an assignment statement.
Answer: a
10.) Given the following code:
Data temp;
X= 13MAR2000d;
run;
What is stored in x?
a.)
13MAR2000
b.)
Corresponds to days from 01 Jan 1960: 14682
c.)
13/03/2000
d.)
Corresponds to days from 01 Jan 1960: 135680
Answer: b
11.)
1----5----10----15----(file abc)
RAM,,20
RAJU,SHARMA,24
data temp;
infile abc dsd;
input FNAME $ LNAME $ AGE;
run;
What will be the value of LNAME for 1st observation?
a.) ,
b.) blank character value
c.) SHARMA
d.) syntax error
Answer: b
if a and b;
run;
How many observations will be there in temp dataset?
a.) 2
b.) 5
c.) 7
d.) 0
Answer: d
19.) Given the following code:
libname temp abc.sds.as;
data temp.X1;
set sasuser.X2;
run;
Which is the correct statement?
a.) In datastep input is read from temporary location and output is written to temporary location.
b.) In datastep input is read from permanent location and output is written to temporary location.
c.) In datastep input is read from temporary location and output is written to permanent location.
d.) In datastep input is read from permanent location and output is written to permanent location.
Answer: d
20.) Given the following code:
1----5----10----15----20 (filename = abc)
ankur
22
data temp;
infile file;
input name $1-10 age 15-16;
/*missing code*/
run;
What is the missing code to write ankur,22 to variable LA;
a.) LA = TRIM(name)||,||put(Age,2.);
b.) LA = name||,||put(Age,2.);
c.) LA = name|| ,||TRIM(put(Age,2.));
d.) LA = put(name)||,||put(Age,3.);
Answer: a
21) Given the following code:
data temp;
merge test1(keep = ID)
test2(keep = ID NAME CLASS AGE);
by ID;
keep = ID NAME;
run;
run;
What would be the value of X and Y in the dataset temp?
a)
b)
c)
d)
Answer: c
25) Flat file structure is as below
1----5----10
dan 23 45
bob 44 50
sue 30 80
mam 40 50
The following code is submitted.
data temp;
infile file specification;
input x $ 1-3;
if x='sue' then input age 5-6;
else input height 8-9;
run;
What would be the value of variable AGE in the dataset TEMP when variable X has the value Sue?
a) 30
b) 44
c) 40
d) 55
Answer: c
26) Flat file structure is as below
1----5----10
vital reddy 45
vijay 30
sarma 40
The following code is submitted.
data temp;
infile file specification;
input x $ age;
if age<=40;
run;
How many observations will be there in the TEMP dataset?
a) 3
b) 2
c) zero observations
d) syntax error
Answer: d
27) The following code is submitted.
data temp;
SALARY='20000';
BONUS=0.1*SALARY;
run;
What would be the value of BONUS variable in the dataset TEMP?
a) 2000
b) 2000
c) .(period)
d) blank
Answer: b
28) The following code is submitted.
data temp;
SALARY=.;
if SALARY=. then SALARY=100;
BONUS=10;
SALARY=.;
total=sum(SALARY,BONUS);
run;
What would be the value of TOTAL variable in the dataset TEMP?
a) 100
b) 110
c) 10
d) .(period)
Answer: c
29) The following statement is submitted within a data step.
if 70<=AGE then call symput(cohort,other);
What is the name of the macro parameter created and what is its value?
a) &cohort; other
b) &other; cohort
c) @AGE; 70
d) syntax error
Answer: a
30) The dataset XYZ is as below
JOBCODE
Chem3
data xyz;
set temp;
if JOBCODE='CHEM3' then description='senior chemist';
else description='unknown';
run;
What is the value of DESCRIPTION variable in the TEMP dataset?
a) senior chemist
b) unknown
c) senior
d) blank characters
Answer: b
31) The following code is submitted.
data temp:
do i=1 to 3;
do j=1 to 4;
salary=salary+300;
end;
end;
run;
How many observations will present in the dataset temp?
a) 1
b) 3
c) 12
d) 0
Answer: a
32) Which of the following code creates the permanent dataset MYDATA from temporary dataset
MYDATA?
Libname out sas-library;
a) data MYDATA;
set MYDATA;
run;
b) data MYDATA;
set out.MYDATA;
run;
c) data out.MYDATA;
set MYDATA;
run;
d) none
Answer: c
33) See the code below
filename rawdata1 u3x2888.reddy.lib(reddy);
libname rawdata2 u3x2888.reddy.saslib
data temp;
5
7
We cant see the length because the data set wont be created due to errors.
None
Answer: a
37) Given the following code:
data temp;
x=4;
if x=5 then do;
y=2;
output;
end;
run;
How many observations will be there in output dataset temp?
a) 1
b) 2
c) 0
d) 3
Answer: c
38) Which variables will be present in dataset FINAL;
data FINAL;
set TRY1(keep= NUM1 NUM2 NUM3 NUM4)
TRY2(keep= NUM5 NUM6 NUM7 NUM8);
drop NUM2 NUM4 NUM7;
keep NUM1 NUM3;
run;
a)
b)
c)
d)
Answer: b
39) Given the following dataset:
SEX_______CITYCODE__________JOB
M
NY
WER
F
NY
WER
M
WD
RES
M
WD
RES
M
SD
ED
M
WF
ED
What will be the correct code to get a cross frequency table as following:
The FREQ Procedure
Table of SEX by CITYCODE
SEX
CITYCODE
Frequency
Percent
Row Pct
Col Pct NY
SD
WD
WF
Total
1
0
1
0
2
16.67 0.00 16.67 0.00 33.33
50.00 0.00 50.00 0.00
50.00 0.00 50.00 0.00
1
1
1
1
4
16.67 16.67 16.67 16.67 66.67
25.00 25.00 25.00 25.00
50.00 100.00 50.00 100.00
Total
2
1
2
1
6
33.33 16.67 33.33 16.67 100.00
a) proc freq data=A;
tables SEX*CITYCODE;
run;
b) proc freq data=A;
tables SEX CITYCODE;
run;
c) proc freq data =A;
tables SEX, CITYCODE;
run;
d) proc freq data =A;
var SEX CITYCODE;
run;
Answer: a
40) A data step merge is preferred over a SQL join when executing a many to many merge. True or
False?
a) True
b) False
Answer: b