SASBase认证专业考试(70真题+答案内容详解).doc

上传人:小** 文档编号:551465 上传时间:2018-10-24 格式:DOC 页数:41 大小:85.52KB
返回 下载 相关 举报
SASBase认证专业考试(70真题+答案内容详解).doc_第1页
第1页 / 共41页
SASBase认证专业考试(70真题+答案内容详解).doc_第2页
第2页 / 共41页
点击查看更多>>
资源描述

《SASBase认证专业考试(70真题+答案内容详解).doc》由会员分享,可在线阅读,更多相关《SASBase认证专业考试(70真题+答案内容详解).doc(41页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、|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

2、;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.

3、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,MAR,26,17,29,11,23,Curr

4、entTina,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 Week51 John FEB Final $13 $25 $14 $27 .2 John MAR Current $26 $17 $29 $11 $233 Tina FEB Final $15 $18 $12 $13 .4 Tina MAR Current $29 $14 $19 $27 $20Which SAS pro

5、gram 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.;r

6、un;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 dollar

7、6.;|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.;

8、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;pr

9、oc print data=WORK.NUMBERS;run;答案:C本题知识点:INFILE 语句与指示器、INFILE filespecification options;其中,filespecification 用来定义文件, options 给出选择项; filespecification 有以下三种形式:|、fileref(文件标志)、filename(文件名)、CARDS 指明输入的数据,紧跟着 CARDS 语句 下列选择项(options)可以出现在 INFILE 语句中:、COLUMN=variable 或 COL=variable 定义一个变量, 其值是指针所在的当前列位置。

10、、END=variable 定义一个变量 , 作为文件结束的标志。、EOF=label 是一个语句标号, 当 INFILE 语句读到文件末尾时, 作为隐含的 GOTO 语句的目标。、LENGHT=variable 定义一个变量, 其值是当前输入数据行的长度。、FIRSTOBS=linenumber 要求从指定的行开始读取数据 , 而不是从文件的第一个记录开始。、OBS=n 指定从一个顺序输入文件中读取数据的最后一个行( 即第 1第 n 行) 。一个观察可能占 n 行。、DLM= 若分隔符不是空格,则使用 DLM=指定、DSD 忽略引号中数值的分隔符;自动将字符数据中的引号去掉;将两个相邻分隔符

11、视为缺失值处理。、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;Wha

12、t 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 中,日期时间是以 1960 年 1 月 1 日 0 时 0 分 0 秒作为起点的。因此,mdy(1,1,1960)=0 。若把日

13、期时间表示为常数时,要使用相应的格式,带单或双引号,在后面紧跟一个 D(日期)、T(时间)、DT(日期时间)。在本题中,日期函数的参数应该是数值,若是字符串,会先尝试字符串是否可以转换为数值,这是自动转换。自动转换是指系统产生一个临时的变量来完成赋值或运算。当自动转换发生时,会在 LOG 窗口中给出提示。1)、字符型变量 - 数值型变量在下面的情况中,VarB 是一个字符型变量,其它是数字型变量。 赋值于一个数字型变量,如:VarA=VarB; 在算术运算中使用,如:VarA=VarB+0; 与一个数字型变量进行比较,如:if VarB=VarA; 在函数中,参数要求数字型变量,如:VarA=

14、sum(VarB,0);2)、数值型变量 - 字符型变量在下面的情况中,VarB 是一个数字型变量,其它是字符型变量。 赋值于一个字符型变量,如:VarA=VarB; 在与要求字符的运算符一起使用,如:VarA=|VarB; 在函数中,参数要求字符型变量,如:VarA=trim(VarB);Q 4The Excel workbook REGIONS.XLS contains the following four worksheets:EASTWESTNORTHSOUTHThe following program is submitted:libname MYXLS regions.xls;|W

15、hich 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 surpris

16、ing 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

17、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

18、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 litera

19、l 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 ra

20、nges. For more information see the Recommended Readings.摘自De-Mystifying the SAS LIBNAME Engine in Microsoft Excel: A Practical GuideQ 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. in

21、file 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=pro

22、duct month num_Sold 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: !,!, What changes should be made to the KEEP statement to correct the errors in the LOG?A. keep=(Product Sales);B. keep

23、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 7|Which of the following choices is an u

24、nacceptable 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 dest

25、ination 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, allo

26、wsyou 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 r

27、earrange, 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

28、(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 synta

29、x 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;

30、run;proc format;value score 1 50 = Fail51 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

31、-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

32、;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 o

33、f 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; 包含美元符号、十六进制、压缩十进制的数据; 日期是最普通的非标准数据。标准数据

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com