sample exam for sas base
TRANSCRIPT
-
8/13/2019 Sample Exam for sas base
1/21
1) The following program is submitted,
Data numercards;
Infile file-specification; Input @1 patient $1! relati"e $ 1#%# @;
If relati"e&children theninput @' diagnosis $1! @;
else if relati"e&parents theninput @%( doctor $1! linic $ ''*
@' diagnosis $1! @; input age; run;
+ow man raw data records are read during each iteration of the data step during e-ecution.
/! 10! %! *D! '
%) The following program is submitted,
Data re"enue; et ear;
2ar1&md31,1,14#5);run;
6hich one of the following "alues does the "ariable 2/71 contain.
-
8/13/2019 Sample Exam for sas base
2/21
/! 1' 0! 1
! 1114#5
D! 181814#5
*) The contents of the raw data file 97:DT are listed below
-
8/13/2019 Sample Exam for sas base
3/21
>77:7= Aile 6:7B!IA!D/T/ dose not e-ist>77:7= Aile 6:7B!?9C!D/T/ does not e-ist
>77:7= Aile 6:7B!CT!D/T/ does not e-ist>77:7= Aile 6:7B!T+>!D/T/ does not e-ist>77:7= Aile 6:7B!:T9T!D/T/ does not e-ist>77:7 %%*%% = nta- error, e-pecting one of the following= a name, a uoted string, 3 , ; >D, B>E, B>E, :0,:9>, 9:IT!
7un;
The I/ libref was pre"iousl assigned in this / session!
6hich one of the following corrects the errors in the F:C.
/! Delete word T+> on the IA statement 0! /dd a semicolon at the end of >T statement
9lace uotes around "alue on IA statementD /dd an >D statement to conclude IA statement!
) / program is submitted and the following log is produced;
Data worG!sets;
Do until3prod gt #); 9rod H 1;
>nd; 7un;
6hich one of the following is the "alue for "ariable 97:D in the output dataset.
/!
-
8/13/2019 Sample Exam for sas base
4/21
0! # D (
#) The following program is submitted;
Data worG!totalsales3Geep&monthsalesJ1%K); set worG!monthlsales3Geep&ear product sales); arra monthsalesJ1%K; do I&1 to 1%;
monthsales3i)&sales; end;
7un;
The data set name 6:7B!?:T+FE/F> has one obser"ation per month for each of fi"e ears for a total of #5obser"ation!
6hich one of the following is the result of the abo"e program.
/! The program fails e-ecution due to data errors! 0! The program fails e-ecution due to snta- errors
The program e-ecutes with warning and create the 6:7B!T:T/F/F> datasetD The program e-ecutes without warning and create the 6:7B!T:T/F/F> dataset!
) The following program is submitted and read 155 records from raw data file =
Data worG!total; Infile filespecification end&eof; Input name $ salar ; Total H salar;
LInsert IA statement hereM
-
8/13/2019 Sample Exam for sas base
5/21
7un;
6hich one of the following IA statement write the last obser"ation to the output dataset.
/! If end&5;0! If eof&5; If end&1;D If eof&1;
() The following program is submitted =
Data worG!test; Airst&Ipswich, >ngland;
itNcountr&substr3first,1,)
-
8/13/2019 Sample Exam for sas base
6/21
+ow man obser"ations are produced b each proc.
/! '55 for proc print'55 for proc means
0! '51 for proc print'51 for proc means
'51 for proc print'55 for proc means
D 55 for proc print555 for proc means
15) / raw data record is listed as below=
-
8/13/2019 Sample Exam for sas base
7/21
11) 6hich one of the following :D statement terminates output being written to an +T?F file.
/! >D0! QIT T:9D F:>
1%) The following program is submitted =
Data worG!test; title&/ title of Two ities, harles R! DicGens; word&scan3title, *, ,);
7un;
6hich one of the following is the "alue of "ariable 6:7D in the output dataset.
/! T0! :f DicGensD 3missing character "alue)
1*) The following program is submitted =
9roc datasets lib&sasuser; ontents data&class "arnum;Quit;
6hich one of the following is the purpose of the 2/7? option .
/! to print a list of "ariables names
-
8/13/2019 Sample Exam for sas base
8/21
0! to print the total number of "ariables to print a list of "ariables in alphabetical orderD to print a list of "ariables in the order the were created!
1') The following program is submitted =
Data worG!Ranuar; et worG!allmonths3Geep&product month numNsold cost); If month&Ran then output worG!Ranuar; ales&costSnumNsold; Beep&product sales;
7un;
6hich "ariables does the dataset 6:7B!Ranuar contain.
/! product and sales onl 0! product, month, numNsold and cost onl
product, sales, month, numNsold, and cost onlD an incomplete output dataset is created due to snta- error!
1) :n which portion3s) of a / dataset does the 97IT procedure report.
/! the data portion onl
0! the descriptor portion onl 0oth portionsD either portion
1#) The content of the raw data file >?9F:E>> are listed below=
-
8/13/2019 Sample Exam for sas base
9/21
Oose *% %%ue *5 **Rohn'5 ''
The following program is submitted=
Data test; Infile >mploee; Input emploeeNname $ 1';
If emploeeNname &ruth then input idnum 15 P11; >lse input age (;
7un;
6hich one does the "ariable ID? contains when the name of the emploee is ruth.
/! 11 0! %%
**D ! 3missing numeric "alue)
1) The following program is submitted =
9roc report data&worG!houses nowd;
olumn stle price; 6here price L 155555; Linsert D>AI> statements hereM
run;
The output looG liGes=
tle price
-
8/13/2019 Sample Exam for sas base
10/21
ondo (5,554,*5
7anch #',555
(#,#5
6hich one of the following completes the program and generate the output.
/! define stle8displa width&4;define price8sum format&comma4! width&15;
0! define stle8width&4;define price8sum format&comm4! width&15;
define stle8group width&4; Define price8sum format&comma4! width&15;
D define stle8order width&4; Define price8sum format&comma4! width&15;
1() The following program is submitted =
Data worG!new; Fength word $!; /mount&;
If amount& then word&/T; >lse if amount& then word&D:C;
>lse word&one; /mount&; run;
6hich one represents the "alues of /?:T and 6:7B "ariables.
/! /mount word D:C
-
8/13/2019 Sample Exam for sas base
11/21
/! /mount word /T
/mount word
D:CD /mount word
3missing character "alue)
14) The following program is submitted =
Data test; et sasuser!emploees; If % le earNser"ice le 15 then amount&1555; >lse if earNser"ice gt 15 then amount&%555;
>lse amount&5;/mountNperNear&earNser"ice8amount;
7un;
6hich one does the "ariable /mountNperNear contains if an emploee has been with the compan for one ear.
/! 50! 1555 %555D ! 3missing numeric "alue)
%5) The following program is submitted =
Fibname compan librarspecification;9roc sort data&compan!paroll; 0 emploeeidnumber;7un;
-
8/13/2019 Sample Exam for sas base
12/21
6hich one represents how the records are sorted.
/! :?9/E!9/E7:FF is recreated in sorted order of >?9F:E>ID?0>7!
0! :?9/E!9/E7:FF is stored in original order, and a new dataset 9/E7:FF is created in sorted order of>?9F:E>ID?0>7!
:?9/E!9/E7:FF is stored in original order, and a new dataset :?9/E!9/E7:FF:7T>D is created insorted order of >?9F:E>ID?0>7!
D :?9/E!9/E7:FF is recreated in sorted order of >?9F:E>ID?0>7, and a new dataset 9/E7:FF iscreated in sorted order of >?9F:E>ID?0>7
%1) The following program is submitted =
Data sasdata!/tlanta sasdata!boston sasdata!9ortland sasdata!phoeni-;
et compan!prdsales; If region&> then output boston; If region&> then output /tlanta; If region&6 then output phoeni-; If region&6 then output 9ortland;
7un;
6hich one of the following is true .
/! no librar references are reuired!
0! the datasets listed on all the IA statements reuires a libref! the datasets listed in the last two IA statement reuires a libref!D the datasets listed in the first two IA statement reuires a libref!
%%) The following program is submitted =
Data worG!clients; alls
-
8/13/2019 Sample Exam for sas base
13/21
Do while 3calls le #); allsH1; >nd;
7un;
6hich one is the "alue for /FF .
/! '0! #D
%*) The output of 97IT procedure of dataset 6:7B!F>2>F is as follows=
:bs name le"el1 AranG 1% Rohn %* Rui %' Rose * 0urt '# Bell ! Ruan 1
The following program is submitted=
Data worG!e-pertise; et worG!le"els; If le"el&! Then e-pertise&nGnown; >lse if le"el&1 then e-pertise&Fow; >lse if le"el&% then e-pertise&?edium; >lse e-pertise&+igh;
-
8/13/2019 Sample Exam for sas base
14/21
7un;
6hich one of the following does the "ariable >U9>7TI> contains.
/! Fow, ?edium, +igh 0! Fow, ?edium, nGnown
Fow, ?edium, +igh, nGnownD Fow, ?edium, +igh, nGnown, and 3missing character "alue)
%') The following program is submitted =
Data worG!empsalar; et worG!people3in&inemp)
6orG!mone3in&insal); If insal and inemp;
7un;
6orG!people has obs, worG!mone has obs!
+ow man obser"ation will the dataset 6:7B!>?9/F/7E contain.
/! 50!
D 1%
%) The following program is submitted =
Fibname sasdata library reference;Data test; et sasdata!chemist3Geep&OobNcode);
-
8/13/2019 Sample Exam for sas base
15/21
If OobNcode&chem* then description&enior hemist; 7un;
2ariable R:0N:D> is a character "ariable with a length of # btes!
6hich one is the length of "ariable D>7I9TI:.
/! # 0! (
1'D %55
%#) The following program is submitted =
Data worG!month; Date&input31%?/7%55*,date4!);
7un;
6hich one represents the tpe and length of D/T>.
/! numeric, ( btes 0! numeric, 4 btes
character, ( btes
D character, 4 btes
%) The following program is submitted =
9roc sort data&sasuser!houses out&report; 0 stle;
7un;
-
8/13/2019 Sample Exam for sas base
16/21
In which librar is the output dataset stored.
/! worG
0! report housesD sasuser
%() The following program is submitted =
Data worG!passengers; If origpassengers&! Then origpassengers&155; Transpassengers&155; :rigpassengers&!;
onpaing&15; Total9assengers&:rig9assengers H Transpassengers; 7un;
6hich one is the "alue for T:T/F9/>C>7.
/! 155 0! 115
%55D ! 3missing numeric "alue)
%4) The following program is submitted =
Data worG!flights; destination&9+; select3destination); when 3F+7) cit&Fondon; when 39+) cit&openhagen;
-
8/13/2019 Sample Exam for sas base
17/21
otherwise cit&:ther; end;7un;
6hich one is the "alue for ITE.
/! :ther 0! openh
openhagenD 3missing character "alue)
*5) The following program is submitted=
:ptions pageno&1;9roc print data&sasuser!houses;7un;9roc means data&sasuser!shoes;
7un;
The report created b 97IT procedure generates pages of output!
6hich is the page number on the first page generated b ?>/ procedure.
/! 1 0! % D #
*1) The following program is submitted =
9roc sort data&worG!emploee;
-
8/13/2019 Sample Exam for sas base
18/21
0 descending fname;9roc sort data&worG!salar; 0 descending fname;
Data worG!empdata; ?erge worG!emploee worG!salar; 0 fname;
7un;
6hich one e-plains wh the program failed e-ecution.
/! The sort procedure contains snta- error! 0! The merge data sets are not permanent / dataset
The datasets were not merged in the order b which the were sorted
D The 7 statement were omitted after each of the sort procedure
*%) / dataset >?9F:E>>NIA: is listed below=
ID umber >-pense%'% 155!55%'* 1*%!1
'%1 %*'!1' *%(% 111!1%
The following program is submitted=
9roc sort data&emploeeNinfo; Linsert 0E statement hereM
7un;
6hich one complete the program and sorts the data seuentiall b descending e-pense "alues within each descending IDnumber "alue.
-
8/13/2019 Sample Exam for sas base
19/21
/! 0 descending Idnumber >-pense; 0! 0 3Idnumber >-pense) descending;
0 Idnumber descending >-pense descending;D 0 descending Idnumber descending >-pense;
**) The following program is submitted =
Data worG!accounting; et worG!dept1 worG!dept%;
7un;
/ character "ariable named R:0:D> e-ists in both datasets! It has a length of in 6:7B!D>9T1 and length of in
6:7B!D>9T%
6hich one is the length of R:0:D> in the output dataset.
/! 0!
(D 1%
*') The following program is submitted =
Data worG!staff; Robcategor&A/; Roble"el&1; Robcategor&Oobcategor
-
8/13/2019 Sample Exam for sas base
20/21
/! A/ 0! A/1
A/ 1D 3missing character "alue)
*) 6hich one is true of 7>T/I statement in / data step.
/! It can be used to assign an initial "alue to NN 0! it is onl "alid in conOunction with a ? function
It has no effect on "ariables read with the >T, ?>7C>, and 9D/T> statements!D It adds the "alue of an e-pression to an accumulate "ariable and ignores the missing "alues
*#) The following program is submitted =
LInsert :D statement hereMproc means data&sasuser!shoes; where product in 3andal,lipper,0oot);
7un;
6hich :D statement complete the program and generate an +T?F file.
/! :D html&sales!html;
0! :D file&sales!html; :D file html&sales!html;D :D html file&sales!html;
-
8/13/2019 Sample Exam for sas base
21/21