




已閱讀5頁,還剩36頁未讀, 繼續免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
SAS Base認證考試70題SAS分多個認證種類:base,advanced,clinic等,但大多需要先通過base認證。但凡這類商業組織提供的考證,基本都是題庫型,所以想考過難度并不大。對于只想拿SAS認證的人,如果熟練掌握網上流傳甚廣的sas真題70題,通過base認證基本就沒問題。Q 11. The following SAS program is submitted:data WORK.TOTAL; set WORK.SALARY; by Department Gender; if First. then Payroll=0; Payroll+Wagerate; if Last.;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. GenderB. DepartmentC. Gender DepartmentD. Department Gender答案:A 本題知識點:自動變量在SAS讀取數據時,在PDV過程中會產生很多自動變量,在輸出的數據集中是不可見的。 FIRST.VARIABLE:同一個BY變量(組),若新的變量值第一次出現時,其first.variable值為1。 LAST.VARIABLE:同一個BY變量(組),若新的變量值最后一次出現時,其last.variable值為1。另外,在BY變量右面有多個變量時,先按第一個變量排序,若第一個變量的觀測存在重復時,才按第二個變量排序。 Q 2Given 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,CurrentThe following output is desired: Obs Name Month Status Week1 Week2 Week3 Week4 Week5 1 John FEB Final $13 $25 $14 $27 . 2 John MAR Current $26 $17 $29 $11 $23 3 Tina FEB Final $15 $18 $12 $13 . 4 Tina MAR Current $29 $14 $19 $27 $20Which SAS program correctly produces the desired output?A. 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;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 $; 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;答案:C本題知識點:INFILE語句與指示器、INFILE filespecification options;其中,filespecification用來定義文件, options給出選擇項; filespecification有以下三種形式:、fileref(文件標志)、filename(文件名)、CARDS指明輸入的數據,緊跟著CARDS語句 下列選擇項(options)可以出現在INFILE語句中:、COLUMN=variable或COL=variable 定義一個變量, 其值是指針所在的當前列位置。、END=variable 定義一個變量, 作為文件結束的標志。、EOF=label是一個語句標號, 當INFILE語句讀到文件末尾時, 作為隱含的GOTO語句的目標。、LENGHT=variable 定義一個變量, 其值是當前輸入數據行的長度。、FIRSTOBS=linenumber 要求從指定的行開始讀取數據, 而不是從文件的第一個記錄開始。、OBS=n 指定從一個順序輸入文件中讀取數據的最后一個行(即第1第n行)。一個觀察可能占n行。、DLM= 若分隔符不是空格,則使用DLM=指定、DSD 忽略引號中數值的分隔符;自動將字符數據中的引號去掉;將兩個相鄰分隔符視為缺失值處理。、MISSOVER 阻止INPUT進入下一行讀取,未賦值變量視為缺失值。、TRUNCOVER 與MISSOVER相似,但在COLUMN INPUT或FORMATTED INPUT中使用。 比較 與 的區別: 用于1個數據行用多個input語句讀取,停留到下一個INPUT語句。 用于1個數據行含有多個觀測值讀取時,停留到下一個DATA步。 Q 3The 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 0B. the character value 01011960C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.答案:A 本題知識點:數據類型的自動轉換在SAS中,日期時間是以1960年1月1日0時0分0秒作為起點的。因此,mdy(1,1,1960)=0。若把日期時間表示為常數時,要使用相應的格式,帶單或雙引號,在后面緊跟一個D(日期)、T(時間)、DT(日期時間)。在本題中,日期函數的參數應該是數值,若是字符串,會先嘗試字符串是否可以轉換為數值,這是自動轉換。自動轉換是指系統產生一個臨時的變量來完成賦值或運算。當自動轉換發生時,會在LOG窗口中給出提示。1)、字符型變量 - 數值型變量在下面的情況中,VarB是一個字符型變量,其它是數字型變量。 賦值于一個數字型變量,如:VarA=VarB; 在算術運算中使用,如:VarA=VarB+0; 與一個數字型變量進行比較,如:if VarB=VarA; 在函數中,參數要求數字型變量,如:VarA=sum(VarB,0);2)、數值型變量 - 字符型變量在下面的情況中,VarB是一個數字型變量,其它是字符型變量。 賦值于一個字符型變量,如:VarA=VarB; 在與要求字符的運算符一起使用,如:VarA=|VarB; 在函數中,參數要求字符型變量,如:VarA=trim(VarB); Q 4The Excel workbook REGIONS.XLS contains the following four worksheets: EAST WEST NORTH SOUTHThe following program is submitted: libname MYXLS regions.xls;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.NORTHe;run;D. proc print data=MYXLS.NORTH$n;run;答案:D本題知識點:打印Excel的某個工作表的數據WHAT IS THAT “$” CHARACTER? Looking at SAS Explorer it may be surprising that each dataset written to Excel appears twice, once with the expected name and once with a trailing “$”. Unlike a typical data source, data in an Excel spreadsheet need not be left and top aligned. For this Excel has named ranges which allow data to be placed anywhere inside a spreadsheet. By default SAS reads and writes data from named ranges on spreadsheets, but will also read spreadsheet data directly in the absence of a named range. When a new SAS dataset is created in an Excel library, SAS creates both a spreadsheet and a named range. Each is given the same name, with thespreadsheet denoted by a trailing “$”. In the example at right CLASS is the named range created by the Excel engine and CLASS$ is the spreadsheet created by the Excel engine to hold the named range. Within SAS, the named range is referred to as Wrkbk.CLASS, and the spreadsheet is referenced using the name literal Wrkbk.CLASS$n. SAS name literals are name tokens written as strings within quotation marks, followed by the letter n. Name literals allow the use of special characters that are not otherwise allowed in SAS names , like the “$” used by the Excel libname engine to distinguish worksheets from named ranges. For more information see the Recommended Readings.摘自De-Mystifying the SAS LIBNAME Engine in Microsoft Excel: A Practical Guide Q 5Which 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 stop10;C. infile customer.txt obs=10;D. input customer.txt stop=10; 答案:C本題知識點:INFILE的選項FIRSTOBS=常數,要求從指定的行開始讀取數據, 而不是從文件的第一個記錄開始。OBS=常數,指定從一個順序輸入文件中讀取數據的最后一個行(即第1第n行)。一個觀測可能占n行。 Q 6After a SAS program is submitted, the following is written to the SAS log: 101 data WORK.JANUARY; 102 set WORK.ALLYEAR(keep=product month num_Sold Cost); 103 if Month=Jan then output WORK.JANUARY; 104 Sales=Cost * Num_Sold; 105 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;答案:D本題知識點:KEEP語句與KEEP=選項在處理大型數據集時,KEEP=選項的效率較高。 KEEP語句:KEEP variable(s); 不能用于過程步。 KEEP=選項:data-set-name( KEEP=variable(s) ) 可以用于數據步(如,DATA語句、SET語句)、過程步。其中,variable(s)是具體變量,不能是數組、_N_、_ERROR_等。 Q 7Which of the following choices is an unacceptable ODSdestination for producing output that can be viewed in Microsoft Excel?A. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXP答案:D本題知識點:ODS輸出Most of these destinations are designed to create output for viewing on a screen or for printing.The OUTPUT destination creates SAS data sets. The MARKUP destination is a general purposetool for creating output in formats defined by tagsets. This includes XML (eXtensible MarkupLanguage), EXCELXP, LaTeX, CSV (comma-separated values), and many other formats where datacan be thought of as separated by tags. The DO CUMENT destination, on the other hand, allowsyou to create a reusable output “document” that yo u can rerender for any destination. So, if yourboss decides he really wants that report in PDF, not RTF, you can replay the output documentwithout having to rerun the entire SAS program that created the data. With an output document,you can also rearrange, duplicate, or delete tables to further customize your output.摘自The Little SAS Book(Fourth) P152頁 Q 8The 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); 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.答案:C本題知識點:類似第1題 Q 9data 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. FailB. PassC. 50.1D. No output答案:C本題知識點:PROC FORMAT語句PROC FORMAT;VALUE namerange-1=formatted-text-1;range-2=formatted-text-2;range-n=formatted-text-n;若name為字符串設計格式,則必須在開頭加$,長度不超過32字節;name不能以數字結尾,除了下劃線外,不能含其他的任何特殊字符。在range右側文本可達到32767字節。 變量值是字符串要加引號。 range是多個值,要用逗號。 連續的要用-。 關鍵字low、high指代變量中最小和最大的非缺失值。 用 排除或指代某些范圍。 other是給其他沒列在VALUE中的變量分配格式。 Q 10The 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 numeric data.D. The variable Discount in the output data set is set to zero. No messages are written to the SAS log.答案:C本題知識點:標準數據、以及數據類型的自動轉換非標準數據 含逗號的數值,如:1,00,001; 包含美元符號、十六進制、壓縮十進制的數據; 日期是最普通的非標準數據。標準數據 數字0-9 英文句號 科學計數、E +、-如果字符型變量轉換后不能作為標準數值讀入,被轉換成的字符型變量有格式要求,必須進行顯式轉換。Q 11Given 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 addedto generate the following results:Analysis Variable : Height N Sex Age Obs Minimum Maximum Mean - F Pre-Teen 3 51.3 59.8 55.8 Teen 6 56.5 66.5 63.0 M Pre-Teen 4 57.3 64.8 59.7 Teen 6 62.5 72.0 66.8 -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;答案:C本題知識點:PROC MEANS過程PROC MEANS ;語句;RUN; data=:數據集maxdec=:指定輸出結果的小數位數,默認為7位noprint:禁止結果在OTPUT窗口輸出alpha:設定可信區間的水平,默認為0.05 MAX、MIN、MEAN、MEDIAN、N、NMISS、RANGE、STDDEV、SUM若不加統計關鍵詞,默認打印的順序:非缺失值個數(N)、均值(MEAN)、標準差(STDDEV)、最小值(MIN)、最大值(MAX)。 語句若在PROC MEAN過程中沒有其他語句,默認輸出所有觀測值和所有數值變量的統計量。BY:分變量單獨分析,數據必須先按變量順序排序,即PROC SORTCLASS:分變量單獨分析,不用排序VAR:指定使用的數值變量Q 12The Excel workbook QTR1.XLS contains thefollowing three worksheets: JAN FEB MARWhich 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);答案:A本題知識點:LIBNAME語句格式LIBNAME librefSAS-data-library ;Q 13The following SAS program is submitted:data WORK.TEST; set WORK.MEASLES(keep=Janpt Febpt Marpt); array Diff3 Difcount1-Difcount3; array Patients3 Janpt Febpt Marpt;run;What new variables are created?A. Difcount1, Difcount2 and Difcount3B. Diff1, Diff2 and Diff3C. Janpt, Febpt, and MarptD. Patients1, Patients2 and Patients3答案:A本題知識點:數組與其他編程語言的數組相比不同在于,SAS數組的每個元素都對應一個變量名。 數值型數組數組說明中的初始值可省略,默認為缺失值。數組說明中變量可省略,變量名默認為數組名+序號。序號從1開始。ARRAY test(3)Math Chinese English (0,0,0);數組元素的個數由變量個數決定。ARRAY test(*) test3-test8;二維數組,數組元素按行排列。ARRAR x(2,2) x11 x12 x21 x22; 字符型數組字符型數組藥指定數組元素的最大長度,其他與數值型數組相同。ARRAY test(2) $ 10 mathor father; 臨時數組若SAS數組每個元素不對應變量名,即為臨時數組。這與其他編程語言相同。ARRAY test(3) _TEMPORARY_ (0,0,0);臨時數組只用于中間計算,不保存入數據集。在數據步中,臨時數組在數據步隱含循環中能自動保留上一步得到的值。Q 14Which 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;答案:C本題知識點:/ debug 語法DEBUG過程的調用方法:在DATA步后面增加DEBUG選項。Q 15Which 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.答案:D本題知識點:自動變量_ERROR_在PDV過程中,產生很多自動變量,可以在數據步的表達式中使用,在輸出數據集中不可見。在PDV過程中,_N_、_ERROR_默認為DROP。在KEEP語句或KEEP=選項中,可以使用除了_N_、_ERROR_之外的變量。Q 16The following SAS program is submitted:data WORK.DATE_INFO; X=04jul2005d; 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.B. DayOfMonth, Year, and MonthOfYear are numeric.C. DayOfMonth and Year are numeric. MonthOfYear is character.D. DayOfMonth, Year, and MonthOfYear are date values.答案:B本題知識點:SAS中日期時間及函數起點:1960年1月1日0時0分0秒。若將日期時間標示為數值型常數,需使用相應格式。格式值帶單引號,后跟一個D(日期)、T(時間)、DT(日期時間)。日期函數返回值為數值。Q 17Given 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;TulsaLos AngelesBangor;run;After data step execution, what will data set WORK.GEO contain?A.City State Region - - - Tulsa OK Western Los Angeles CA Western Bangor WesternB.City State Region - - - Tulsa OK Western Los Angeles CA Western BangorC.City State Region - - - Tulsa OK Central Los Angeles CA Western Bangor WesternD.City State Region - - - Tulsa OK Central Los CA Western Bangor答案:A本題知識點:IF語句若執行語句不能在一個語句完成,則使用復合語句DO和ENDIF 條件 THEN 語句;沒有ENDIF,沒有IF-ELSEIF-ELSE多分支結構,語句1只能是一個語句。IF 條件 THEN 語句1;;Q 18Which 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.答案:C本題知識點:WHERE語句類似第15題。Q 19The SAS data set WORK.ONE contains a numeric variable named Num and a
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度電力行業應急響應演練計劃
- 建設工程風險評估與造價咨詢合同
- 企業內部培訓講師選拔流程
- 小班動物知識競賽活動計劃
- 小學英語文化知識復習計劃
- 航空航天材料檢測試驗項目計劃
- 二手數碼產品買賣合同
- 廣告效果優化合同
- 2025年國際疫苗接種合作計劃
- 八年級語文閱讀課時安排計劃
- 2022年省南平市高校畢業生服務社區計劃招募考試真題
- 注塑模具結構最清晰原創圖文含動畫
- 光伏作業活動風險分級管控清單參考模板范本
- The Three Goats(課件)譯林黑布林分級繪本
- GB/T 9865.1-1996硫化橡膠或熱塑性橡膠樣品和試樣的制備第一部分:物理試驗
- 大一物理實驗報告 答辯 霍爾效應與應用設計PPT
- 《巡游出租汽車經營申請表》
- 2023年山東高考英語試題答案及詳細解析word版
- 《職業病危害因素分類目錄》(國衛疾控發〔2015〕92號)
- 特種作業人員臺賬及個人檔案表
- 2022內分泌內科三基考試題庫及答案
評論
0/150
提交評論