SAS Base认证考试70真题 答案详解Word文档格式.docx

上传人:b****3 文档编号:7752964 上传时间:2023-05-09 格式:DOCX 页数:79 大小:43.45KB
下载 相关 举报
SAS Base认证考试70真题 答案详解Word文档格式.docx_第1页
第1页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第2页
第2页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第3页
第3页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第4页
第4页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第5页
第5页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第6页
第6页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第7页
第7页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第8页
第8页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第9页
第9页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第10页
第10页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第11页
第11页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第12页
第12页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第13页
第13页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第14页
第14页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第15页
第15页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第16页
第16页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第17页
第17页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第18页
第18页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第19页
第19页 / 共79页
SAS Base认证考试70真题 答案详解Word文档格式.docx_第20页
第20页 / 共79页
亲,该文档总共79页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

SAS Base认证考试70真题 答案详解Word文档格式.docx

《SAS Base认证考试70真题 答案详解Word文档格式.docx》由会员分享,可在线阅读,更多相关《SAS Base认证考试70真题 答案详解Word文档格式.docx(79页珍藏版)》请在冰点文库上搜索。

SAS Base认证考试70真题 答案详解Word文档格式.docx

自动变量

在SAS读取数据时,在PDV过程中会产生很多自动变量,在输出的数据集中是不可见的。

·

FIRST.VARIABLE:

同一个BY变量(组),若新的变量值第一次出现时,其first.variable值为1。

LAST.VARIABLE:

同一个BY变量(组),若新的变量值最后一次出现时,其last.variable值为1。

另外,在BY变量右面有多个变量时,先按第一个变量排序,若第一个变量的观测存在重复时,才按第二个变量排序。

Q2

GiventhefollowingrawdatarecordsinTEXTFILE.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

Thefollowingoutputisdesired:

ObsNameMonthStatusWeek1Week2Week3Week4Week5

1JohnFEBFinal$13$25$14$27.

2JohnMARCurrent$26$17$29$11$23

3TinaFEBFinal$15$18$12$13.

4TinaMARCurrent$29$14$19$27$20

WhichSASprogramcorrectlyproducesthedesiredoutput?

A.dataWORK.NUMBERS;

lengthName$4Month$3Status$7;

infile'

TEXTFILE.TXT'

dsd;

inputName$Month$;

ifMonth='

FEB'

theninputWeek1Week2Week3Week4Status$;

elseifMonth='

MAR'

theninputWeek1Week2Week3Week4Week5Status$;

formatWeek1-Week5dollar6.;

run;

procprintdata=WORK.NUMBERS;

B.dataWORK.NUMBERS;

dlm='

'

missover;

C.dataWORK.NUMBERS;

inputName$Month$@;

D.dataWORK.NUMBERS;

dsd@;

C

INFILE语句与指示器@、@@

INFILEfilespecificationoptions;

其中,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相似,但在COLUMNINPUT或FORMATTEDINPUT中使用。

比较@与@@的区别:

@用于1个数据行用多个input语句读取,停留到下一个INPUT语句。

@@用于1个数据行含有多个观测值读取时,停留到下一个DATA步。

Q3

ThefollowingSASprogramissubmitted:

dataWORK.DATE_INFO;

Day="

01"

;

Yr=1960;

X=mdy(Day,01,Yr);

WhatisthevalueofthevariableX?

A.thenumericvalue0

B.thecharactervalue"

01011960"

C.amissingvalueduetosyntaxerrors

D.thestepwillnotcompilebecauseofthecharacterargumentinthemdyfunction.

数据类型的自动转换

在SAS中,日期时间是以1960年1月1日0时0分0秒作为起点的。

因此,mdy(1,1,1960)=0。

若把日期时间表示为常数时,要使用相应的格式,带单或双引号,在后面紧跟一个D(日期)、T(时间)、DT(日期时间)。

在本题中,日期函数的参数应该是数值,若是字符串,会先尝试字符串是否可以转换为数值,这是自动转换。

自动转换是指系统产生一个临时的变量来完成赋值或运算。

当自动转换发生时,会在LOG窗口中给出提示。

1)、字符型变量->

数值型变量

在下面的情况中,VarB是一个字符型变量,其它是数字型变量。

赋值于一个数字型变量,如:

VarA=VarB;

在算术运算中使用,如:

VarA=VarB+0;

与一个数字型变量进行比较,如:

ifVarB>

=VarA;

在函数中,参数要求数字型变量,如:

VarA=sum(VarB,0);

2)、数值型变量->

字符型变量

在下面的情况中,VarB是一个数字型变量,其它是字符型变量。

赋值于一个字符型变量,如:

在与要求字符的运算符一起使用,如:

VarA='

'

||VarB;

在函数中,参数要求字符型变量,如:

VarA=trim(VarB);

Q4

TheExcelworkbookREGIONS.XLScontainsthefollowingfourworksheets:

EAST

WEST

NORTH

SOUTH

Thefollowingprogramissubmitted:

libnameMYXLS'

regions.xls'

WhichPROCPRINTstepcorrectlydisplaystheNORTHworksheet?

A.procprintdata=MYXLS.NORTH;

B.procprintdata=MYXLS.NORTH$;

C.procprintdata=MYXLS.'

NORTH'

e;

D.procprintdata=MYXLS.'

NORTH$'

n;

D

打印Excel的某个工作表的数据

WHATISTHAT“$”CHARACTER?

LookingatSASExploreritmaybesurprisingthateachdatasetwrittentoExcelappearstwice,oncewiththeexpectednameandoncewithatrailing“$”.

Unlikeatypicaldatasource,datainanExcelspreadsheetneednotbeleftandtopaligned.ForthisExcelhasnamedrangeswhichallowdatatobeplacedanywhereinsideaspreadsheet.BydefaultSASreadsandwritesdatafromnamedrangesonspreadsheets,butwillalsoreadspreadsheetdatadirectlyintheabsenceofanamedrange.

WhenanewSASdatasetiscreatedinanExcellibrary,SAScreatesbothaspreadsheetandanamedrange.Eachisgiventhesamename,withthespreadsheetdenotedbyatrailing“$”.

IntheexampleatrightCLASSisthenamedrangecreatedbytheExcelengineandCLASS$isthespreadsheetcreatedbytheExcelenginetoholdthenamedrange.WithinSAS,thenamedrangeisreferredtoasWrkbk.CLASS,andthespreadsheetisreferencedusingthenameliteralWrkbk.’CLASS$’n.

SASnameliteralsarenametokenswrittenasstringswithinquotationmarks,followedbythelettern.NameliteralsallowtheuseofspecialcharactersthatarenototherwiseallowedinSASnames,likethe“$”usedbytheExcellibnameenginetodistinguishworksheetsfromnamedranges.FormoreinformationseetheRecommendedReadings.

摘自《De-MystifyingtheSASLIBNAMEEngineinMicrosoftExcel:

APracticalGuide》

Q5

Whichstatementspecifiesthatrecords1through10aretobereadfromtherawdatafilecustomer.txt?

A.infile'

customer.txt'

1-10;

B.input'

stop@10;

C.infile'

obs=10;

D.input'

stop=10;

INFILE的选项

FIRSTOBS=常数,要求从指定的行开始读取数据,而不是从文件的第一个记录开始。

OBS=常数,指定从一个顺序输入文件中读取数据的最后一个行(即第1~第n行)。

一个观测可能占n行。

Q6

AfteraSASprogramissubmitted,thefollowingiswrittentotheSASlog:

101dataWORK.JANUARY;

102setWORK.ALLYEAR(keep=productmonthnum_SoldCost);

103ifMonth='

Jan'

thenoutputWORK.JANUARY;

104Sales=Cost*Num_Sold;

105keep=ProductSales;

-----

22

ERROR22-322:

Syntaxerror,expectingoneofthefollowing:

!

!

&

*,**,+,-,

<

=,<

>

=,>

>

=,

AND,EQ,GE,GT,IN,LE,LT,MAX,MIN,NE,NG,NL,

NOTIN,OR,^=,|,||,~=.

106run;

WhatchangesshouldbemadetotheKEEPstatementtocorrecttheerrorsintheLOG?

A.keep=(ProductSales);

B.keepProduct,Sales;

C.keep=Product,Sales;

D.keepProductSales;

KEEP语句与KEEP=选项

在处理大型数据集时,KEEP=选项的效率较高。

KEEP语句:

KEEPvariable(s);

不能用于过程步。

KEEP=选项:

data-set-name(KEEP=variable(s))可以用于数据步(如,DATA语句、SET语句)、过程步。

其中,variable(s)是具体变量,不能是数组、_N_、_ERROR_等。

Q7

WhichofthefollowingchoicesisanunacceptableODSdestinationforproducingoutputthatcanbeviewedinMicrosoftExcel?

A.MSOFFICE2K

B.EXCELXP

C.CSVALL

D.WINXP

ODS输出

Mostofthesedestinationsaredesignedtocreateoutputforviewingonascreenorforprinting.

TheOUTPUTdestinationcreatesSASdatasets.TheMARKUPdestinationisageneralpurpose

toolforcreatingoutputinformatsdefinedbytagsets.ThisincludesXML(eXtensibleMarkup

Language),EXCELXP,LaTeX,CSV(comma-separatedvalues),andmanyotherformatswheredata

canbethoughtofasseparatedbytags.TheDOCUMENTdestination,ontheotherhand,allows

youtocreateareusableoutput“document”thatyoucanrerenderforanydestination.So,ifyour

bossdecideshereallywantsthatreportinPDF,notRTF,youcanreplaytheoutputdocument

withouthavingtoreruntheentireSASprogramthatcreatedthedata.Withanoutputdocument,

youcanalsorearrange,duplicate,ordeletetablestofurthercustomizeyouroutput.

摘自《TheLittleSASBook》(Fourth)P152页

Q8

TheSASdatasetnamedWORK.SALARYcontains10observationsforeachdepartment,andiscurrentlyorderedbyDepartment.

dataWORK.TOTAL;

setWORK.SALARY(keep=DepartmentMonthlyWageRate);

byDepartment;

ifFirst.Department=1thenPayroll=0;

Payroll+(MonthlyWageRate*12);

ifLast.Department=1;

Whichstatementistrue?

A.ThebystatementintheDATAstepcausesasyntaxerror.

B.ThestatementPayroll+(MonthlyWageRate*12);

inthedatastepcausesasyntaxerror.

C.ThevaluesofthevariablePayrollrepresentthemonthlytotalforeachdepartmentintheWORK.SALARYdataset.

D.ThevaluesofthevariablePayrollrepresentamonthlytotalforallvaluesofWAGERATEintheWORK.SALARYdataset.

类似第1题

Q9

datacourse;

inputexam;

datalines;

50.1

procformat;

valuescore1–50=‘Fail’

51–100=‘Pass’;

procreportdata=coursenowd;

columnexam;

defineexam/displayformat=score.;

Whatisthevalueforexam?

A.Fail

B.Pass

C.50.1

D.Nooutput

PROCFORMAT语句

PROCFORMAT;

VALUEname

range-1=’formatted-text-1′;

range-2=’formatted-text-2′;

……

range-n=’formatted-text-n’;

若name为字符串设计格式,则必须在开头加$,长度不超过32字节;

name不能以数字结尾,除了下划线外,不能含其他的任何特殊字符。

在range右侧文本可达到32767字节。

变量值是字符串要加引号。

range是多个值,要用逗号。

连续的要用-。

关键字low、high指代变量中最小和最大的非缺失值。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2