logo资料库

SAS Base认证考试题库—70题(完整答案版).doc

第1页 / 共31页
第2页 / 共31页
第3页 / 共31页
第4页 / 共31页
第5页 / 共31页
第6页 / 共31页
第7页 / 共31页
第8页 / 共31页
资料共31页,剩余部分请下载后查看
1. The following SAS program is submitted: data WORK.TOTAL; set WORK.SALARY; by Department Gender; if First.<_insert_code_> then Payroll=0; Payroll+Wagerate; if Last.<_insert_code_>; run; The SAS data set WORK.SALARY is currently ordered by Gender within Department. Which inserted code will accumulate subtotals for each Gender within Department? A. Gender B. Department C. Gender Department D. Department Gender 2. Given the following raw data records in TEXTFILE.TXT: ----|----10---|----20---|----30 John,FEB,13,25,14,27,Final John,MAR,26,17,29,11,23,Current Tina,FEB,15,18,12,13,Final Tina,MAR,29,14,19,27,20,Current The following output is desired: John FEB John MAR Tina FEB Tina MAR Obs Name Month Status 1 2 3 4 $14 $29 $12 $19 Which SAS program correctly produces the desired output? A. data WORK.NUMBERS; Final Current Final Current Week1 Week2 Week3 Week4 Week5 $13 $26 $15 $29 $27 $11 $13 $27 $25 $17 $18 $14 . $23 . $20 length Name $ 4 Month $ 3 Status $ 7; infile 'TEXTFILE.TXT' dsd; input Name $ Month $; if Month='FEB' then input Week1 Week2 Week3 Week4 Status $; else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; format Week1-Week5 dollar6.; run; proc print data=WORK.NUMBERS; run; B. data WORK.NUMBERS; length Name $ 4 Month $ 3 Status $ 7; infile 'TEXTFILE.TXT' dlm=',' missover; input Name $ Month $; if Month='FEB' then input Week1 Week2 Week3 Week4 Status $; else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; 1
format Week1-Week5 dollar6.; run; proc print data=WORK.NUMBERS; run; C. data WORK.NUMBERS; length Name $ 4 Month $ 3 Status $ 7; infile 'TEXTFILE.TXT' dlm=','; input Name $ Month $ @; if Month='FEB' then input Week1 Week2 Week3 Week4 Status $; else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; format Week1-Week5 dollar6.; run; proc print data=WORK.NUMBERS; run; D. data WORK.NUMBERS; length Name $ 4 Month $ 3 Status $ 7; infile 'TEXTFILE.TXT' dsd @; input Name $ Month $; if Month='FEB' then input Week1 Week2 Week3 Week4 Status $; else if Month='MAR' then input Week1 Week2 Week3 Week4 Week5 Status $; format Week1-Week5 dollar6.; run; proc print data=WORK.NUMBERS; run; 3. The following SAS program is submitted: data WORK.DATE_INFO; Day="01" ; Yr=1960 ; X=mdy(Day,01,Yr) ; run; What is the value of the variable X? A. the numeric value 0 B. the character value "01011960" C. a missing value due to syntax errors D. the step will not compile because of the character argument in the mdy function. 4. The Excel workbook REGIONS.XLS contains the following four worksheets: EAST WEST NORTH SOUTH The following program is submitted: libname MYXLS 'regions.xls'; 2
Which PROC PRINT step correctly displays the NORTH worksheet? A. proc print data=MYXLS.NORTH;run; B. proc print data=MYXLS.NORTH$;run; C. proc print data=MYXLS.'NORTH'e;run; D. proc print data=MYXLS.'NORTH$'n;run; 5. Which statement specifies that records 1 through 10 are to be read from the raw data file customer.txt? A. infile 'customer.txt' 1-10; B. input 'customer.txt' stop@10; C. infile 'customer.txt' obs=10; D. input 'customer.txt' stop=10; 6. After a SAS program is submitted, the following is written to the SAS log: 101 102 103 104 105 data WORK.JANUARY; set WORK.ALLYEAR(keep=product month num_Sold Cost); if Month='Jan' then output WORK.JANUARY; Sales=Cost * Num_Sold; keep=Product Sales; ----- 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, , <=, <>, =, >, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=. 106 run; What changes should be made to the KEEP statement to correct the errors in the LOG? A. keep=(Product Sales); B. keep Product, Sales; C. keep=Product, Sales; D. keep Product Sales; 7. Which of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft Excel? A. MSOFFICE2K B. EXCELXP C. CSVALL D. WINXP 8. The SAS data set named WORK.SALARY contains 10 observations for each department, and is currently ordered by Department. The following SAS program is submitted: data WORK.TOTAL; set WORK.SALARY(keep=Department MonthlyWageRate); 3
by Department; if First.Department=1 then Payroll=0; Payroll+(MonthlyWageRate*12); if Last.Department=1; run; Which statement is true? A. The by statement in the DATA step causes a syntax error. B. The statement Payroll+(MonthlyWageRate*12); in the data step causes a syntax error. C. The values of the variable Payroll represent the monthly total for each department in the WORK.SALARY data set. D. The values of the variable Payroll represent a monthly total for all values of WAGERATE in the WORK.SALARY data set. 9. data course; input exam; datalines; 50.1 ; run; proc format; value score 1 – 50 = ‘Fail’ 51 – 100 = ‘Pass’; run; proc report data =course nowd; column exam; define exam / display format=score.; run; What is the value for exam? A. Fail B. Pass C. 50.1 D. No output 10. The following SAS program is submitted: data WORK.RETAIL; Cost='$20.000'; Discount=.10*Cost; run; What is the result? A. The value of the variable Discount in the output data set is 2000. No messages are written to the SAS log. B. The value of the variable Discount in the output data set is 2000. A note that conversion has taken place is written to the SAS log. C. The value of the variable Discount in the output data set is missing. A note in the SAS log refers to invalid 4
numeric data. D. The variable Discount in the output data set is set to zero. No messages are written to the SAS log. 11. Given the existing SAS program: proc format; value agegrp low-12 ='Pre-Teen' 13-high = 'Teen'; run; proc means data=SASHELP.CLASS; var Height; class Sex Age; format Age agegrp.; run; Which statement in the proc means step needs to be modified or added to generate the following results: Analysis Variable : Height N Obs Minimum Sex Age ------------------------------------------------------------------ F Pre-Teen Teen Pre-Teen Teen M 3 6 4 6 Maximum Mean 59.8 66.5 64.8 72.0 55.8 63.0 59.7 66.8 51.3 56.5 57.3 62.5 -------------------------------------------------------------------- A. var Height / nobs min max mean maxdec=1; B. proc means data=SASHELP.CLASS maxdec=1 ; C. proc means data=SASHELP.CLASS min max mean maxdec=1; D. output nobs min max mean maxdec=1; 12. The Excel workbook QTR1.XLS contains the following three worksheets: JAN FEB MAR Which statement correctly assigns a library reference to the Excel workbook? A. libname qtrdata 'qtr1.xls'; B. libname 'qtr1.xls' sheets=3; C. libname jan feb mar 'qtr1.xls'; D. libname mydata 'qtr1.xls' WORK.heets=(jan,feb,mar); 13. The following SAS program is submitted: data WORK.TEST; set WORK.MEASLES(keep=Janpt Febpt Marpt); array Diff{3} Difcount1-Difcount3; array Patients{3} Janpt Febpt Marpt; 5
run; What new variables are created? A. Difcount1, Difcount2 and Difcount3 B. Diff1, Diff2 and Diff3 C. Janpt, Febpt, and Marpt D. Patients1, Patients2 and Patients3 14. Which of the following programs correctly invokes the DATA Step Debugger: A. data WORK.TEST debug; set WORK.PILOTS; State=scan(cityState,2,' '); if State='NE' then description='Central'; run; B. data WORK.TEST debugger; set WORK.PILOTS; State=scan(cityState,2,' '); if State='NE' then description='Central'; run; C. data WORK.TEST / debug; set WORK.PILOTS; State=scan(cityState,2,' '); if State='NE' then description='Central'; run; D. data WORK.TEST / debugger; set WORK.PILOTS; State=scan(cityState,2,' '); if State='NE' then description='Central'; run; 15. Which statement is true concerning the SAS automatic variable _ERROR_? A. It cannot be used in an if/then condition. B. It cannot be used in an assignment statement. C. It can be put into a keep statement or keep= option. D. It is automatically dropped. 16. The following SAS program is submitted: data WORK.DATE_INFO; X='04jul2005'd; DayOfMonth=day(x); MonthOfYear=month(x); Year=year(x); run; What types of variables are DayOfMonth, MonthOfYear, and Year? A. DayOfMonth, Year, and MonthOfYear are character. 6
B. DayOfMonth, Year, and MonthOfYear are numeric. C. DayOfMonth and Year are numeric. MonthOfYear is character. D. DayOfMonth, Year, and MonthOfYear are date values. 17. Given the following data step: data WORK.GEO; infile datalines; input City $20.; if City='Tulsa' then State='OK'; Region='Central'; if City='Los Angeles' then State='CA' Region='Western'; datalines; Tulsa Los Angeles Bangor ; run; Region After data step execution, what will data set WORK.GEO contain? A. City ----------- Tulsa Los Angeles Bangor Western Western Western State ------- ----- OK CA B. City ----------- Tulsa Los Angeles Bangor C. City ----------- Tulsa Los Angeles Bangor D. City ----------- Tulsa Los Bangor State ------- ----- OK CA Region Western Western State ------- ----- OK CA State ------- ----- OK CA Region Central Western Western Region Central Western 7
18. Which statement describes a characteristic of the SAS automatic variable _ERROR_? A. The _ERROR_ variable maintains a count of the number of data errors in a DATA step. B. The _ERROR_ variable is added to the program data vector and becomes part of the data set being created. C. The _ERROR_ variable can be used in expressions in the DATA step. D. The _ERROR_ variable contains the number of the observation that caused the data error. 19. The SAS data set WORK.ONE contains a numeric variable named Num and a character variable named Char: WORK.ONE Num Char --- 1 3 1 ---- 23 23 77 The following SAS program is submitted: proc print data=WORK.ONE; where Num='1'; run; What is output? A. Num Char --- 1 ---- 23 B. Num Char --- 1 1 ---- 23 77 C. Num Char --- 1 3 1 ---- 23 23 77 D. No output is generated. 20. The data set WORK.REALESTATE has the variable LocalFee with a format of 9. and a variable CountryFee with a format of 7.; The following SAS program is submitted: data WORK.FEE_STRUCTURE; format LocalFee CountryFee percent7.2; set WORK.REALESTAT; LocalFee=LocalFee/100; CountryFee=CountryFee/100; run; What are the formats of the variables LOCALFEE and COUNTRYFEE in the output dataset? 8
分享到:
收藏