版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、百度文库-让每个人平等地提升自我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.<_insert_code_> then Payroll=0;Payro
2、ll+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. GenderB. DepartmentC. Gender DepartmentD. Department Gender答案:A本题知识点:自动变量在SAS读取数据时,在 PDV过程中会产生
3、很多自动变量,在输出的数据集中是不可见的。? 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-|30John,FEB,13,25,14,27,FinalJohn
4、,MAR,26,17,29,11,23,CurrentTina,FEB,15,18,12,13,FinalTina,MAR,29,14,19,27,20,CurrentThe following output is desired:Obs Name Month Status Week1 Week2 Week3 Week4 Week51JohnFEBFinal13 2514 27.2JohnMARCurrent26 1729 11$233TinaFEBFinal15 1812 13.4TinaMARCurrent29 1419 27$20Which SAS program correctly p
5、roduces the desired output?A. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT dsd;input Name Month ;if Month='FEB' then input Weekl Week2 Week3 Week4 Status $;else if Month='MAR' then input Weekl Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;
6、run;proc print data=WORK.NUMBERS;run;B. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=',' missover;input Name Month ;if Month='FEB' then input Weekl Week2 Week3 Week4 Status $;else if Month='MAR' then input Weekl Week2 Week3 Week4 Week5 S
7、tatus $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;C. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT' dlm=','input Name Month ;if Month='FEB' then input Weekl Week2 Week3 Week4 Status $;else if Month='MAR' then input Weekl
8、 Week2 Week3 Week4 Week5 Status $;format Week1-Week5 dollar6.;run;proc print data=WORK.NUMBERS;run;D. data WORK.NUMBERS;length Name 4Month 3 Status $ 7;infile 'TEXTFILE.TXT' dsd ;input Name Month ;if Month='FEB' then input Week1 Week2 Week3 Week4 Status $;else if Month='MAR'
9、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语句?下列选择
10、项(options)可以出现在INFILE语句中:、COLUMN=variable或COL=variable定义一个变量,其值是指针所在的当前列位置。、END=variable定义一个变量,作为文件结束的标志。、EOF=label是一个语句标号,当INFILE语句读到文件末尾时,作为隐含的GOTO语句 的目标。、LENGHT=variable定义一个变量,其值是当前输入数据行的长度。、FIRSTOBS=linenumber要求从指定的行开始读取数据,而不是从文件的第一个记录开始。行(即第1第n行)。一个观察、OBS=n指定从一个顺序输入文件中读取数据的最后一个 可能占n行。、DLM=若分隔符不
11、是空格,则使用DLM=指定将两个相邻分隔符视、DSD忽略引号中数值的分隔符;自动将字符数据中的引号去掉;为缺失值处理。、MISSOVER 阻止INPUT进入下一行读取,未赋值变量视为缺失值。、TRUNCOVER 与 MISSOVER 相似,但在 COLUMN INPUT 或 FORMATTED INPUT 中 使用。比较与的区别:? 用于1个数据行用多个input语句读取,停留到下一个 INPUT语句。? 则于1个数据行含有多个观测值读取时,停留到下一个DATAUQ 3The following SAS program is submitted:data WORK.DATE_INFO;Day=
12、"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 "01011960"C. a missing value due to syntax errorsD. the step will not compile because of the character argument in the mdy function.答案:A本题知识点:数据类型的自动转换在SAS中,日期时间是以19
13、60年1月1日0时0分0秒作为起点的。因此,mdy(1,1,1960)=0。若把日期时间表示为常数时,要使用相应的格式,带单或双引号,在后面紧跟一个D(日期)、 T (时间)、DT (日期时间)。在本题中,日期函数的参数应该是数值,若是字符串,会先尝试字符串是否可以转换为数值,这是自动转换。自动转换是指系统产生一个临时的变量来完成赋值或运算。当自动转换发生时,会在LOG窗口中给出提示。1)、字符型变量-> 数值型变量在下面的,f#况中,VarB是一个字符型变量,其它是数字型变量。?赋值于一个数字型变量,如: VarA=VarB ;?在算术运算中使用,如: VarA=VarB+0;?与一个
14、数字型变量进行比较,如:if VarB>=VarA;?在函数中,参数要求数字型变量,如: VarA=sum(VarB,0);2)、数值型变量-> 字符型变量在下面的,f#况中,VarB是一个数字型变量,其它是字符型变量。?赋值于一个字符型变量,如: VarA=VarB;?在与要求字符的运算符一起使用,如: VarA=''|VarB;?在函数中,参数要求字符型变量,如: VarA=trim(VarB);Q 4The Excel workbook REGIONS.XLS contains the following four worksheets:EASTWESTNOR
15、THSOUTHThe 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.'NORTH'e;run;D. proc print data=MYXLS.'NORTH$'n;ru
16、n;答案: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过 Unlikeatypicaldatasource,datainanExcelspreadsheetneednotbeleftandtopaligned orthisExcelhas
17、namedrangeswhichallowdatatobeplacedanywhereinsideaspreadsheet ydefaultSASreadsandwhtesdatafromnamedrangesonspreadsheetstwillalsoreadspre adsheetdatadirectlyintheabsenceofanamedrange/henanewSASdatasetiscreatedinanE xcellibrary .SAScreatesbothaspreadsheetandanamedrandEachisgiventhesamename withthespre
18、adsheetdenotedbyatrailing % .In the example at right CLASS is the named range created by the Excel engine andCLASS$ 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 lite
19、ral Wrkbk. ' CLASS$ nSAS 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 work
20、sheets from named ranges. For more information see the Recommended Readings.»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' ob
21、s=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
22、 Cost);103 if Month='Jan' then output WORK.JANUARY;104 Sales=Cost * Num_Sold;105 keep=Product Sales;22ERROR 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;Wha
23、t 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) 可以用于数据
24、步(如,DATA句、SET语句)、过程步。其中,variable(s)是具体变量,不能是数组、_N_、_ERROR_。Q 7Which of the following choices is an unacceptable ODSdestination for producing output that canbe viewed in Microsoft Excel?A. MSOFFICE2KB. EXCELXPC. CSVALLD. WINXP答案:D本题知识点:ODS俞出Most of these destinations are designed to create output for
25、 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 wh
26、ere datacan be thought of as separated by tags. The DO CUMENT destination, on the other hand, allows you to create a reusable output“ document " that yo u can rerertdertifem.any , deyourboss decides he really wants that report in PDF, not RTF, you can replay the output document without having t
27、o 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 c
28、urrently 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
29、 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 value
30、s 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 =' formattedext-1range-2='
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025关于企业租赁办公场地的租赁合同
- 2025年农产品购销合同范本
- 2025年短视频内容分发合作协议(流量共享)
- 2025年短视频内容创作者合作协议(流量置换)
- 2025年短视频剪辑与发布合同协议
- 2025实验室设备紧急采购合同
- 2025股权转让合同模板【股权转让合同】
- 简易抵押协议书怎么写
- 易语言附加协议书头
- 协议书作废 番茄
- 装配流水线控制系统的设计
- 电力系统应对极端天气自然灾害存在的薄弱环节及对策建议
- 思想道德与法治2023版第三章继承优良传统 弘扬中国精神第3讲 教学设计
- 普通心理学第六版PPT完整全套教学课件
- 临床医学基础科目十门联考习题册(题库一页两版)
- TF公司销售业务内部控制优化研究
- “六五”普法·初中生法制教育读本
- 2023年12月英语四级真题第一套资料
- GB/T 9286-1998色漆和清漆漆膜的划格试验
- GB/T 11348.5-2008旋转机械转轴径向振动的测量和评定第5部分:水力发电厂和泵站机组
- 你来比划我来猜(英语)课件
评论
0/150
提交评论