好文档 - 专业文书写作范文服务资料分享网站

SAS base 50题 训练题(含答案及解析) 

天下 分享 时间: 加入收藏 我要投稿 点赞

Which statement(s) complete(s) the program and produce(s) a running total of the Receipts variable? a. total+receipts;

total 0; b.

sum total;

c. total=total+receipts;

d. total=sum(total,receipts);

Correct answer: a

The SUM function and the assignment statement do not retain values across iterations of the DATA step. The sum statement total+receipts; initializes total to 0, ignores missing values of receipt, retains the value of total from one iteration to the next, and adds the value of receipts to total.

You can learn about the sum statement in Creating and Managing Variables. 19.A raw data file is listed below.

1---+----10---+----20---+--- 1901 2 1905 1 1910 6 1925 1 1941 1

The following SAS program is submitted and references the raw data file above:

data money;

infile 'file-specification'; input year quantity; total=total+quantity; run;

What is the value of total when the data step finishes executing?

a. b. c. d. 0 1 11

. (missing numeric value)

Correct answer: d

The variable Total is assigned a missing value during the compilation phase of the DATA step. When the first record is read in, SAS processes: total=.+2; which results in a missing value. Therefore the variable Total remains missing for all observations. You can learn about

?

the compilation phase of the DATA step in Understanding DATA Step Processing

SAS中文论坛网站http://www.mysas.net SAS中文论坛FTP站ftp://mysas.vicp.net

?

using missing values with arithmetic operators in Creating SAS Data Sets from Raw Data.

20.The following program is submitted:

data test;

average=mean(6,4,.,2); run;

What is the value of average?

a. b. c. d. 0 3 4

. (missing numeric value)

Correct answer: c

The MEAN function adds all of the non-missing values and divides by the number of non-missing values. In this case, 6 + 4 + 2 divided by 3 is 4.

You can learn about the MEAN function in Transforming Data with SAS Functions. 21.The following SAS program is submitted:

data work.AreaCodes;

Phonenumber=3125551212;

Code='('!!substr(Phonenumber,1,3)!!')'; run;

Which one of the following is the value of the variable Code in the output data set? a. ( 3) b. (312) c. 3 d. 312

Correct answer: a

An automatic data conversion is performed whenever a numeric variable is used where SAS expects a character value. The numeric variable is written with the BEST12. format and the resulting character value is right-aligned when the conversion occurs. In this

example, the value of Phonenumber is converted to character and right-aligned before the SUBSTR function is performed. Since there are only 10 digits in the value of

Phonenumber, the right-aligned value begins with two blanks. Therefore the SUBSTR function picks up two blanks and a 3, and uses the BEST12. format to assign that value to Code. Then, the parentheses are concatenated before and after the two blanks and a 3. You can learn about automatic data conversion and the SUBSTR function in Transforming Data with SAS Functions. 22.The following SAS program is submitted:

data work.inventory; products=7;

SAS中文论坛网站http://www.mysas.net SAS中文论坛FTP站ftp://mysas.vicp.net

do until (products gt 6); products+1; end; run;

Which one of the following is the value of the variable products in the output data set? a. 5 b. 6 c. 7 d. 8

Correct answer: d

A DO UNTIL loop always executes at least once because the condition is not evaluated until the bottom of the loop. In the SAS program above, the value of Products is

incremented from 7 to 8 on the first iteration of the DO UNTIL loop, before the condition is checked. Therefore the value of Products is 8.

You can learn about DO UNTIL loops in Generating Data with DO Loops. 23.The following program is submitted:

data work.test;

set work.staff (keep=salary1 salary2 salary3); run;

Which ARRAY statement completes the program and creates new variables? a. array salary{3};

b. array new_salary{3};

c. array salary{3} salary1-salary3;

d. array new_salary{3} salary1-salary3; Correct answer: b

Although each of the ARRAY statements listed above is a valid statement, only Answer B creates new variables named new_salary1, new_salary2 and new_salary3. Answer C and Answer D both create an array that groups the existing data set variables salary1, salary2, and salary3. Since the array in Answer A is named salary, it also uses the existing data set variables.

You can learn about creating new variables in an ARRAY statement in Processing Variables with Arrays.

24.Which of the following permanently associates a format with a variable? a. the FORMAT procedure

b. a FORMAT statement in a DATA step c. an INPUT function with format modifiers d. an INPUT statement with formatted style input Correct answer: b

SAS中文论坛网站http://www.mysas.net SAS中文论坛FTP站ftp://mysas.vicp.net

To permanently associate a format with a variable, you use the FORMAT statement in a DATA step. You can use the FORMAT procedure to create a user-defined format. You use the INPUT function to convert character data values to numeric values with an informat. You use the INPUT statement to read data into a data set with an informat. You can learn about

? ? ? ? ?

permanently assigning a format to a variable in Creating and Managing Variables

the FORMAT statement in Creating List Reports

the FORMAT procedure in Creating and Applying User-Defined Formats the INPUT function in Transforming Data with SAS Functions the INPUT statement in Reading Raw Data in Fixed Fields.

25.The following report is generated:

Style

of homes Price

n Asking

CONDO 4 $99,313

RANCH 4 $68,575

3 $77,983 SPLIT

4 $83,825 TWOSTORY

Which of the following steps created the report? a. proc freq data=sasuser.houses;

tables style price /nocum; format price dollar10.;

label style=\ price=\run;

proc print data=sasuser.houses; b.

class style; var price;

table style,n price*mean*f=dollar10.; label style=\ price=\run;

proc means data=sasuser.houses n mean; c.

class style; var price;

format price dollar10.;

label style=\ price=\run;

proc report data=sasuser.houses nowd headline; d.

column style n price;

define style / group \ define price / mean format=dollar8. \run;

SAS中文论坛网站http://www.mysas.net SAS中文论坛FTP站ftp://mysas.vicp.net

Correct answer: d

The FREQ procedure cannot create the average asking price. The CLASS statement and the VAR statement are not valid for use with the PRINT procedure. The MEANS

procedure output would have both the N statistic and the N Obs statistic since a CLASS statement is used. The REPORT procedure produced the report. You can learn about

? ? ? ?

the FREQ procedure in Producing Descriptive Statistics the PRINT procedure in Creating List Reports

the MEANS procedure in Producing Descriptive Statistics

the REPORT procedure in Creating Enhanced List and Summary Reports.

26.A SAS report currently flows over two pages because it is too long to fit within the specified display dimension. Which one of the following actions would change the display dimension so that the report fits on one page? a. Increase the value of the LINENO option. b. Decrease the value of the PAGENO option. c. Decrease the value of the LINESIZE option. d. Increase the value of the PAGESIZE option. Correct answer: d

The PAGESIZE= SAS system option controls the number of lines that compose a page of SAS procedure output. By increasing the number of lines available per page, the report might fit on one page.

You can learn about the PAGESIZE= option in Referencing Files and Setting Options. 27.Which one of the following SAS REPORT procedure options controls how column headings are displayed over multiple lines? a. SPACE= b. SPLIT= c. LABEL= d. BREAK= Correct answer: b

The SPLIT= option specifies how to split column headings. The SPACE=, LABEL= and BREAK= options are not valid options in PROC REPORT.

You can learn about the SPLIT= option for the REPORT procedure in Creating Enhanced List and Summary Reports.

SAS中文论坛网站http://www.mysas.net SAS中文论坛FTP站ftp://mysas.vicp.net

SAS base 50题 训练题(含答案及解析) 

Whichstatement(s)complete(s)theprogramandproduce(s)arunningtotaloftheReceiptsvariable?a.total+receipts;total0;b.sumtotal;c.total=total+receip
推荐度:
点击下载文档文档为doc格式
5mpqt0nssl555jd3wygd
领取福利

微信扫码领取福利

微信扫码分享