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

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

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

b. a SAS data set named Group only

c. both a SAS data set named Group and a raw data file d. The program fails execution due to errors. Correct answer: c

The DATA step creates a temporary data set named Group and reads data from the

permanent SAS data set named Sasdata.Group into it. The FILE statement creates a raw data file by writing out values for the variables Name and Age to the file that is specified within the quotation marks. You can learn about

? ?

temporary data sets in Basic Concepts

the FILE statement in Creating SAS Data Sets from Raw Data.

36.The SAS data set Employee_info is listed below.

employee 2542 3612 2198 2198

bonus 100.00 133.15 234.34 111.12

The following SAS program is submitted:

proc sort data=employee_info; run;

Which one of the following BY statements completes the program and sorts the data in sequential order by descending bonus values within ascending employee values? a. by descending bonus employee; b. by employee bonus descending; c. by employee descending bonus; d. by descending employee bonus; Correct answer: c

You use the keyword DESCENDING in a BY statement to specify that data will be sorted by values in descending order. The DESCENDING keyword applies to the

variable that is listed immediately after it. To sort on values of bonus within sorted values of employee, you list employee first in the BY statement.

You can learn about the DESCENDING keyword and the BY statement in Creating List Reports.

37.The following SAS program is submitted:

data work.accounting; length jobcode $ 12; set work.department;

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

run;

The Work.Department SAS data set contains a character variable named jobcode with a length of 5. Which of the following is the length of the variable jobcode in the output data set? a. 5 b. 8 c. 12

d. The value cannot be determined because the program fails to execute due to syntax errors.

Correct answer: c

The LENGTH statement enables you to specify the length of a character variable. Since the LENGTH statement appears before the SET statement, SAS will set the length of jobcode to 12.

You can learn about the LENGTH statement in Creating and Managing Variables. 38.Assume the SAS data set Sasuser.Houses has four numeric variables. The following SAS program is submitted:

proc means data=sasuser.houses mean; run;

The following report is produced:

CONDO baths 2.7500000 2.1250000 RANCH 4 bedrooms

2.2500000 baths

2.0000000 SPLIT 3 bedrooms baths 2.6666667 1.8333333 TWOSTORY 4 bedrooms

3.0000000 baths

1.8750000

style

N Obs Variable Mean 4 bedrooms

Which of the following statement(s) create(s) this report? a. class style;

b. var bedrooms baths; c. class style;

var bedrooms baths;

var style; d.

class bedrooms baths;

Correct answer: c

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

The CLASS statement specifies the category variable(s) for group processing. The VAR statement specifies the numeric variable(s) for which to calculate statistics. You can learn about the CLASS statement and the VAR statement in Producing Descriptive Statistics.

39.An HTML file contains a SAS report. Which ODS statement option is used to specify the name of the HTML file? a. OUT= b. FILE= c. HTML= d. HTMLFILE= Correct answer: b

The FILE= option identifies the file that contains the HTML output. The FILE= option is an alias for the BODY= option in the ODS HTML statement.

You can learn about the FILE= option in the ODS HTML statement in Producing HTML Output.

40.The following SAS program is submitted:

data work.test;

set sasuser.class;

array t{3} (5, 10, 15); run;

Which one of the following completes the ARRAY statement and creates data elements that are not included in the SAS data set Work.Test? a. _DROP_ b. _TEMP_

c. _TEMPORARY_ d. No extra text is needed. Correct answer: c

_TEMPORARY_ is a keyword used in the ARRAY statement to create temporary data elements. By default, the ARRAY statement creates new data set variables or references existing variables for use by the array.

You can learn about the _TEMPORARY_ keyword and the ARRAY statement in Processing Variables with Arrays. 41.A raw data file is listed below.

1---+----10---+----20---+--- 01/05/1989 Frank 11 12/25/1987 June 13 01/05/1991 Sally 9

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

The following SAS program is submitted using the raw data file as input:

data work.family;

infile 'file-specification';

input @1 date_of_birth mmddyy10. @15 first_name $5. @25 age 3; run;

proc print data=work.family noobs; run;

Which one of the following is the result?

a. The program executes, but the age values are missing in the output. b. The program executes, but the date values are missing in the output.

c. The program fails to execute because the age informat is coded incorrectly. d. The program fails to execute because the date informat is coded incorrectly. Correct answer: a

Values for the variable age are missing in the output because the informat for age is coded incorrectly. Since age is standard numeric input, it should use the w.d informat to specify a field width of 3 in the INPUT statement.

You can learn about the w.d informat in Reading Raw Data in Fixed Fields. 42.Assume that SAS data sets Sasdata.Products and Sasdata.Sales both contain the Prod_ID variable. Which of the following SAS DATA steps returns only exceptions or non matches? a. libname sasdata 'SAS-data-library';

data all;

merge sasdata.products sasdata.sales; by prod_id;

if ins=1 or inp=1; run;

libname sasdata 'SAS-data-library'; b.

data all;

merge sasdata.products(in=inp) sasdata.sales(in=ins); by prod_id;

if ins=1 and inp=1; run;

libname sasdata 'SAS-data-library'; c.

data all;

merge sasdata.products(in=inp) sasdata.sales(in=ins); by prod_id;

if ins=0 and inp=0; run;

libname sasdata 'SAS-data-library'; d.

data all;

merge sasdata.products(in=inp)

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

sasdata.sales(in=ins); by prod_id;

if ins=0 or inp=0; run;

Correct answer: d

By default, DATA step match-merges combine all observations in all input data sets. To include only unmatched observations from your output data set, you can use the IN= data set option to create and name a temporary variable that indicates whether the data set contributed to the current observations. If the value of the IN= variable is 0, the data set did not contribute to the current observation; if the value is 1, the data set did contribute to the current observation. You can use a subsetting IF statement to only include those observations that have a value of 0 for the IN= variable of either the Sasdata.Products data set or the Sasdata.Sales data set. Since an unmatched observation might come from either input data set, you do not need to specify that the IN= variables for both Sasdata.Products and Sasdata.Sales have values of 0.

You can learn about the IN= data set option in Combining SAS Data Sets. 43.The following SAS program is submitted:

libname sasdata 'SAS-data-library'; libname labdata 'SAS-data-library'; data labdata.boston

labdata.dallas(drop=city dest equipment); set sasdata.cities(keep=orig dest city price equipment);

if dest='BOS' then output labdata.boston;

else if dest='DFW' then output labdata.dallas; run;

Which variables are output to both data sets? a. price and orig only

b. city and equipment only

c. city, price, and equipment only d. city, price, orig, and equipment Correct answer: a

In the program above, the KEEP= option specifies that 5 variables (orig, dest, city, price, and equipment) are read from the input data set. All of these variables are output to Labdata.Boston. In the Labdata.Dallas output data set, the DROP= option specifies that city, dest, and equipment are excluded from the data set so that only orig and price are included.

You can learn about the KEEP= option in Creating and Managing Variables. 44.

The following SAS program is submitted:

proc contents data=sasuser._all_ nods; run;

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

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

b.aSASdatasetnamedGrouponlyc.bothaSASdatasetnamedGroupandarawdatafiled.Theprogramfailsexecutionduetoerrors.Correctanswer:cTheDATAstep
推荐度:
点击下载文档文档为doc格式
5mpqt0nssl555jd3wygd
领取福利

微信扫码领取福利

微信扫码分享