151. Which SAS function below returns an argument with
leading blanks moved to the end of the value?
1. RIGHT
2. TRIM
3. LENGTH
4. JUSTIFY
5. LEFT
152. What is one of the uses of a "@" when reading
a file in a DATA step?
1. To trim the space to the right of a
character variable in the INPUT statement
2. To create a SAS constant
3. To hold a record in the input buffer for further processing
4. To test
the relationship between two values
5. To separate elements of a
character string
153. When a DATA step is submitted, in what order are data
set options and DATA step statements processed?
1. Options on
INPUT data sets, then options on OUTPUT data sets, then STATEMENTS
2. Options on
STATEMENTS, then options on OUTPUT data sets, then options on INPUT data sets
3. Options on
STATEMENTS, then options on INPUT data sets, then options on OUTPUT data sets
4. Options on
OUTPUT data sets, then STATEMENTS, then options on INPUT data sets
5. Options on
INPUT data sets, then STATEMENTS, then options on OUTPUT data sets
154. Which PROC below is used to acquire descriptor
information about a data set?
1. PROC STATISTICS
2. PROC MEANS
3. PROC CONTENTS
4. PROC DESCRIPTION
5. PROC CATALOG
155. What is the effect of the SAS statement OPTIONS
MISSING=?
1. It specifies the
character to be printed for missing numeric variables.
2. It indicates whether or not the DATA step is to account
for missing values in a PROC statement (0 for no and 1 for yes).
3. It aborts a program if missing values are encountered
during DATA step processing.
4. It controls the maximum number of missing values which
will be written to a data set.
5. It controls whether or not missing variables are written
to the data set.
156. Data Set Fruit
Data Set Veggie
OBS VAR1 Fruit
OBS VAR1 Veggie
1 a banana
1 a bean
2 b melon
2 b pea
3 c grape
3 c corn
4 c grape
If data set FRUIT and data set VEGGIE are concatenated to
create data set BOTH, how many observations would data set BOTH contain?
1. Two
2. Three
3. Four
4. Five
5. Seven
157. Which OPTION keyword on a PROC SUMMARY specifies to
output only the observations with the highest _TYPE_ value to a data set?
1. MISSING
2. MAXDEC
3. IDMIN
4. ORDER=data
5. NWAY
158. IF CITY=:'A';
What does the
SAS statement above do?
1. If
there is an A anywhere in the city variable, it selects that observation.
2. It
selects all cities that contain an a in the value.
3. If
a SCAN of the variable city indicates a character value, it selects that
observation.
4. It selects those observations with cities beginning with an
A.
5. It
formats the variable city with a trailing blank.
159. A programmer wants to read rows 100 through 200 of an
external file.
Which of the following
infile statements should she use?
1. infile
x obs=100 lastobs=200;
2. infile
x firstobs=101 lastobs=201;
3. infile
x obs=101 lastobs=200;
4. infile
x firstobs=101 obs=201;
5. infile x firstobs=100 obs=200;
160. Which OPTION statement below will center a printout?
1.
JUSTIFY=FULL
2. NOCENTEROFF
3. CENTERON
4. CENTER
5.
JUSTIFY=CENTER
161. data a;
set x;
run;
options obs=5;
data b;
set x;
run;
data c;
set x;
output;
output;
run;
Assuming data set X contains seven observations in the
sample code above, what are the number of observations that are written
respectively to the data sets A, B, and C?
1. 5,5,5
2. 5,7,5
3. 7,7,5
4. 7,5,5
162. Which numeric INFORMAT below converts blanks to zeros?
1. BITSw.d
2. BZw.d
3. BLZRw.d
4. $HEXw.
5. BINARYw.d
163. In ARRAY processing, what does the DIM function do?
1. It
specifies the lower bound of an implicit array.
2. It defines
an implicit array.
3. It suppresses the output of an
implicit array in data set processing.
4. It assigns a subscript to each of
the array elements.
5. It returns the number of elements
in a dimension of an array.
164. Which date function below returns the number of time
intervals in a given time span?
1. INTNX
2. INTCK
3. INTRR
4. MDY
5. ABS.
165. data test;
input @1 x $7. @1 y
date7. @8 mm 2. @10 dd 2. @12 yy 2.;
z = mdy (mm, dd, yy);
format y z mmddyy10.;
cards;
01SEP00090100
03AUG99080399
05OCT88100588
24NOV99112499
;
proc sort data=test out=test1; by x;
proc sort data=test out=test2; by y;
proc sort data=test out=test3; by z;
proc print data=test1;
proc print data=test2;
proc print data=test3; run;
Assume that 00 is the yy value for 2000 and the SAS system
options are set to SAS Version6 default values. Which data set in the sample
code above (TEST1 or TEST2 or TEST3) will contain dates sorted in the expected
ascending order?
1. TEST1
Only
2. TEST2
Only
3. TEST3
Only
4. Both
TEST2 and TEST3
5. None
of the above
166. %let LIB=WORK;
%let
DSN=TEST;
PROC print data=&LIB.&DSN;
run;
What needs to be done in order to print data set WORK.TEST?
1. You
must put &LIB in %NRSTR().
2. You
must put &DSN in %STR().
3. You
must add a period.
4. You
must add OPTIONS DLM='.' before the PROC step.
5. Nothing
- the sample code is correct.
167. Which function below returns a remainder when an
integer quotient of argument one divided by argument two is calculated?
1. ABS
2. MOD
3. NMISS
4. MIN
5. RANUNI
168. data test;
infile cards;
input #2 @1 x $4. //
@1 y $4.;
cards;
1234
5678
9012
3456
7890
;
proc print; run;
What is
the output of the sample code above?
Choice 1
OBS X
Y
1 9012 9012
2 1234
1234
Choice 2
OBS X
Y
1 9012 3456
Choice 3
OBS X
Y
1 5678 3456
2 1234 5678
Choice 4
OBS X
Y
1 5678 3456
2 1234 5678
3 1234 9012
Choice 5
OBS X
Y
1
5678 3456
169. Which of the following statements is true concerning
PROC SQL?
1. SQL can
sort and summarize, but a PROC PRINT is necessary in order to get a printout of
a job.
2. Direct
access by POINTER= control is available.
3. SQL can sort, summarize, and print in one PROC.
4. Data needs
to be sorted.
5. WHERE
statements are not permitted in SQL.
170. Which of the following statements comparing PUT and
OUTPUT statements is valid?
1. OUTPUT writes observations to a SAS data set. PUT writes
variable values or text to a SAS output file or to an external file.
2. OUTPUT statements must be included in a DATA step if the
data is to be written to a data set, but a PUT statement is not needed to write
to a flat file.
3. OUTPUT results are raw data written to an external file,
but PUT results are SAS data sets.
4. The OUTPUT statement is explicit in a DATA step when
writing to a SAS data set, but the PUT statement is implicit in DATA step
processing.
5. None of the above are true.
171. data _null_;
x=1/3;
if x=.3333 then put 'fraction';
Will the PUT statement in the sample code above write out
'fraction', and if not, what code must be used?
1. Yes.
2. No.
if ABS(x,.0001)=.3333 then
3. No.
if ROUND(x,.0001)=.3333 then
4. No.
if MOD(x,3)=0 then
5. No.
if PUT(x,.00001)=.3333 then
172. Which statement below assigns a value produced in a
DATA step to a macro variable?
1. %SYSLPUT
2. %SET
3. %SYSCALL
4. CALL SYMPUT
5. %EVAL
173. Which statement selects observations to be processed in
a PROC step?
1. WHERE
2. THEN
3. IF
4. WHEN
5. IF-THEN
174. %macro test;
%do j=1 %to
10;
data
temp&j;
%if &j = 1
%then (retain var1 var2 var3;);
%else %if
&j = 2 %then (retain var4 var5 var6;);
..more sas
statements
%end;
%mend;
Given the sample code above, what keyword is needed at the
for this MACRO to work?
1. %STR
2. %QSCAN
3. %QUOTE
4. %SYMPUT
5. %UNQUOTE
175. Which of the following statements below is a valid
comment format in SAS?
1. PROC
COMMENT: put comment here;
2. /* put comment here */
3. / put
comment here /
4. */ put
comment here /*
5. * put
comment here *
176. Which of the
following is true about LINK statements?
1. When more than one LINK statement has been executed, a
RETURN statement tells the SAS system to go to the top of the DATA step.
2. A LINK statement is possible only in SQL.
3. The LINK statement and the destination must be in the
same DATA step.
4. The actions of a LINK statement and a GOTO statement are
identical.
5. A DATA step may
have an infinite number of LINK statements.
177. PROC SORT data=TEST NODUPKEY;
by VAR1;
run;
Given the
above sample code, what happens to observations in data set TEST?
1. If
VAR1's value was repeated in TEST, then all but one of the observations with
that value were removed.
2. If
VAR1's value was repeated in TEST, then all the observations with that value
were removed, but only if the rest of the variables had identical values.
3. If
VAR1's value was repeated in TEST, then all the observations with that value
were removed.
4. The
value of first.VAR1 and last.VAR1 are both equal to zero.
5. If
VAR1's value was repeated in TEST, then all the by variables are set to
missing.
178. proc format;
value x
(fuzz=.3)
1='one'
2='two'
3='three';
What is the
purpose of the FUZZ option in the sample code above?
1. It
specifies a width of the decimal value - in this case 3 decimal places.
2. It indicates that if a variable falls within .3 of the value
specified in the value statement, the corresponding label is used to print the
value.
3. It
prints the label defined in the value if the variable value contains a .3.
4. It
multiplies the value of the variable times .3, and if the result equals the
label (a certain number as defined in the DATA step), then prints the label.
5. It
divides the value of the variable by .3, and if the result equals the label (a
certain number as defined in the DATA step), then prints the label.
179. Which of the following creates a MACRO variable and
assigns it a value?
1. %MACRO
2. %MEND
3. %PUT
4. %LET
5. %KEYDEF
180. In order to access a SAS data set in future SAS
sessions, what must be done?
1. The SAS
data set must be created using a one-level SAS name.
2. The SAS data set must be created using a two-level SAS name.
3. Permanent
SAS data sets are not available in programming.
4. The SAS data set must be created with the
libref of "WORK" attached.
5. All SAS
data sets are available for future use once they are created in a DATA step.
181. data x;
do obsnum = 1
to 10;
output;
end;
run;
Which DATA step below will generate a subset of 5 OBS in
data set X?
Choice 1
data x;
set x;
where _n_
lt 6;
run;
Choice 2
data x;
set x (obs=5);
run;
Choice 3
data x;
set x
obs=5;
run;
Choice 4
data x;
set x
(where=(obs=5));
run;
Choice 5
data x
(where=(obs=5));
set x;
run;
182. Data Set A
Data Set B Data Set C
(list of
Democrats)
OBS NAME SEX OBS NAME
AGE OBS NAME
1 Ed M
1 Ed 40
1 Ed
2 Frank M
2 Frank 44
2 Frank
3 Karen F
3 Karen 30
3 Tom
4 Tom M
4 Tom 55
5 Wanda F
5 Wanda 49
Given the three sorted data sets A, B, and C (a list of
Democrats) in the sample printout above, which DATA step below would produce a
data set containing in each observation the name, sex, and age of only those
who are NOT Democrats?
Choice 1
data D;
set A B
C;
run;
Choice 2
data D;
merge A
(in =a) B (in=b) C;
by
name;
if a
and b and c;
run;
Choice 3
data D;
merge
A B
C (in=c):
by name;
if c=0;
run;
Choice 4
data D;
merge A
B C;
by name;
run;
Choice 5
data D;
merge A
(in=a) B (in=b) C;
if a = 1
and b =1;
by name;
run;
183. If var1 then salary='added to income';
Assuming that VAR1 is numeric, which of the following
statements is equivalent to the sample above?
1. The
variable VAR1 is a character variable, and if it has a non-blank value, then assign
'added to income' to salary.
2. If
the variable VAR1 earned is present, then go to label marked salary=added to
income.
3. If
the variable VAR1 is in the program data vector, then assign 'added to income'
to salary.
4. Select
all of the observations where salary is 'added to income'.
5. If
the variable VAR1 is not equal to '.' or 0, then salary = 'added to income'.
184. data x;
infile y;
input a b +5
c;
run;
When reading in a raw file using an INPUT statement, what
does '+5' do in the sample code above?
1. It
advances the pointer to column 5 of the next input line.
2. It
moves the column pointer to column 5.
3. It moves the pointer 5 columns.
4. It
moves the pointer to the line 5.
5. It
inputs 5 lines into one observation.
185. In a PROC TABULATE, what table option supplies an
integer value that specifies the number of print positions allotted to the
heading in the row dimension?
1. BOX=
2. FORMCHAR=
3. RTS=
4. PPR=
5. FUZZ=
186. In a PROC PRINT, is it possible to print only those
variables that begin with a certain value, such as all variables that begin
with the letter A?
1. Yes. To print out only those
variables beginning with the letter A, use A: in the VAR statement of the PROC
PRINT.
2. No. In order to specify what variables to print, all the
variables must be spelled out in their entirety. The only exception is for the
INPUT statement.
3. Yes. To print out only those variables beginning with the
letter A, use &A in the VAR statement of the PROC PRINT.
4. No. Nowhere in SAS can you abbreviate a variable,
including the INPUT statement.
5. Yes. To print out only those variables beginning with the
letter A, use A% in the VAR statement.
187. Which of the following is true of the OPTIONS statement
in SAS programs?
1. The OPTIONS statement can only be used
at the beginning of a program.
2. The
OPTIONS statement can only be used in a DATA step.
3. The OPTIONS statement CANNOT be used within CARDS data lines.
4. The
OPTIONS statement must be used within a PROC step.
5. One
OPTIONS statement CANNOT be overridden by another OPTIONS statement.
188. data test;
input @1 x $1. @2 y
$1. @3 z $1.;
cards;
ABC
AAB
ABA
;
proc sort data=test;
by x y z;
data test;
set test;
by x y z;
fx = first.x; fy =
first.y; fz = first.z;
lx = last.x; ly =
last.y; lz = last.z;
run;
Based on the above program, what are the values of the
following variables in data set TEST?
A. 1st observation - fx = ?
B. 1st observation - lz = ?
C. 2nd observation - ly = ?
D. 2nd observation - lz = ?
E. 3rd observation - fy = ?
1. A=1 B=1 C=1
D=0 E=1
2. A=1 B=0 C=0
D=1 E=0
3. A=0 B=1 C=1
D=1 E=1
4. A=1 B=1 C=1
D=1 E=0
5. A=1 B=1 C=0
D=1 E=0
189. Which SAS function below returns the value "TEST"?
1. SCAN ("THIS IS JUST A
TEST", 5)
2. LOCATE ("THIS IS JUST A TEST", 5)
3. SUBSTR ("THIS IS JUST A TEST",
"TEST")
4. INDEX ("THIS
IS JUST A TEST", 5)
5. INDEX ("THIS IS JUST A TEST", "TEST")
190. This program generates output;
proc format; value
$birds
' '='missing'
other='not missing';
run;
data x;
do i=1 to 3;
if i=1 then bird='
';
if i=2 then
bird='cardinal';
if i=3 then
bird='wren';
end;
proc print;
proc freq;
table bird;
format bird $birds.;
run;
Referring to the program above, what are the values of
through in the following output?
Output:
OBS I BIRD
BIRD Frequency Percent
-----------------------------
1. A=1
B=4 C=wren D=not missing E=1
2. A=1
B=3 C=W D=missing E=1
3. A=3
B=3 C=blank D=missing E=1
4. A=1
B=3 C=wren D=wren E=1
5. A=1 B=4 C=W D=not missing E=1
data employee;
infile 'employee.dat'; /* Assuming directory-based system */
input id $6. name $20. @30 locale $10.;
run;
A. List
B. Column
C. Formatted
D. Mixed
E. Standard
ans: b
192. True or False...(Choose one)
The extesion of ".sas" is required for sas program files.
A. True
B. False
Ans: b
193. Which of the following are valid statements concerning reading raw data files using list input: (Choose all
that apply)
A. The DLM= is an option for the infile statement for specifying delimiters.
B. All variables have a default length of 8 bytes.
C. When the input statement runs into an end-of-line marker, it stops reading data even
though there are more fields specified.
D. You use a $ after a variable name to specify a character variable.
E. Fields are read from left to right.
Ans: a,d,e
194. Given the following raw data file, offices.dat, in a directory-based system, which data step would create a
SAS data set with one observation for each region: (Choose One)
1 1 2 2 3 3 4
1234567890123456789012345678901234567890
East Maryland Vermont Maine
Central Illinois Iowa Kansas Missouri
West California Washington
A.
data offices;
infile 'offices.dat' stopover;
input region $ state1-state4 $;
run;
B.
data offices;
infile 'offices.dat' missover;
input region $ (state1-state4) ($);
run;
C.
data offices;
infile 'offices.dat' delim=" ";
input region $ state1 $ state2 $ state3 $ state4 $;
run;
D.
data offices;
infile 'offices.dat';
input region $ state1-state4 $.;
run;
E. None of the above.
data offices;
infile 'offices.dat' stopover;
input region $ state1-state4 $;
run;
B.
data offices;
infile 'offices.dat' missover;
input region $ (state1-state4) ($);
run;
C.
data offices;
infile 'offices.dat' delim=" ";
input region $ state1 $ state2 $ state3 $ state4 $;
run;
D.
data offices;
infile 'offices.dat';
input region $ state1-state4 $.;
run;
E. None of the above.
Ans: e
195. The double trailing
"@@" in an input statement...(Choose all that apply) A. holds the current data line in the buffer for another input statement to process
B. can be used to read multiple observations from a single data line
C. loads a new record into the input buffer if an end-of-record is found in the current record
D. is a syntax error.
E. None of the above.
Ans: a, b
196. Which SAS statement below will change the characteristics of a variable if it was used in a data step?
A. SCAN
B. ATTRIB
C. FORMAT
D. PUT
E. ARRAY
Ans: d
197. Which X variable has a value of 1 at the end of an input file?
A. END = X
B. OBS = X
C. EOF = X
D. LASTOBS = X
E. NOOBS = X
Ans: a
198. Given a data file with 100 columns of data, you only need to read in the first 70 columns. Which of the
following could you use:
A. infile x line = 70;
B. infile x length = 71;
C. infile x missover = 70;
D. infile x ls=70;
E. infile x linesize=70;
199. In the following code sample:
data xyz;
infile abc;
input h i +3 j;
run;
What does the +3 do?
A. It moves the pointer down 3 records
B. It moves the column pointer to column 3
C. It adds 3 to the value read into variable i
D. It advances the column pointer 3 places
E. It advances the column pointer 4 places
Ans: d
200. What does the following SAS statement do?
if location =: 'C';
A. It selects the observation if there is a 'C' in the location value.
B. It selects the observation if there is a 'C' at the first position in the location value.
C. It selects the observation if the location value is 'C'.
D. It selects the observation if the location value contains a lowercase 'c'.
E. None of the above, it's a typo.
Ans: b
No comments:
Post a Comment