SAS统计软件试题

合集下载

sas测试题及答案

sas测试题及答案

sas测试题及答案1. SAS中,如何将一个数据集的所有变量的值增加10?A. data dataset; set dataset; +10; run;B. data dataset; set dataset; +10; quit;C. data dataset; set dataset; +10; run;D. data dataset; set dataset; +10;答案:C2. 在SAS中,如何创建一个新的数据集,并将原数据集中的变量`Var1`和`Var2`复制到新数据集中?A. data new_dataset; set old_dataset; Var1 =old_dataset.Var1; Var2 = old_dataset.Var2; run;B. data new_dataset; set old_dataset; Var1 = Var1; Var2 = Var2; run;C. data new_dataset / old_dataset; set old_dataset; Var1 = old_dataset.Var1; Var2 = old_dataset.Var2; run;D. data new_dataset; set old_dataset; Var1 = Var1; Var2 = Var2; quit;答案:A3. SAS中,如何使用`proc print`步骤打印数据集的前10行?A. proc print data=dataset firstobs=10;B. proc print data=dataset firstobs=1 obs=10;C. proc print data=dataset firstobs=10;D. proc print data=dataset firstobs=1 obs=10;答案:B4. 在SAS中,如何使用`if-then`语句来创建一个新的变量`NewVar`,当`Var1`大于10时,`NewVar`的值为`Var1`的两倍,否则为0?A. data dataset; set dataset; if Var1 > 10 then NewVar = 2 * Var1; else NewVar = 0; run;B. data dataset; set dataset; if Var1 > 10 then NewVar = 2 * Var1; NewVar = 0; run;C. data dataset; set dataset; if Var1 > 10 NewVar = 2 *Var1; else NewVar = 0; run;D. data dataset; set dataset; if Var1 > 10 then NewVar = 2 * Var1; else NewVar = 0; quit;答案:A5. SAS中,如何使用`proc means`步骤计算数据集中`Var1`的平均值?A. proc means data=dataset N mean of Var1;B. proc means data=dataset N mean Var1;C. proc means data=dataset N=mean Var1;D. proc means data=dataset N mean Var1;答案:D结束语:以上是SAS测试题及答案,希望能够帮助您更好地理解和掌握SAS编程的基础知识。

sas期末考试题

sas期末考试题

sas期末考试题一、选择题(每题3分,共30分)1. SAS系统中,用于读取数据集的语句是:A. proc print data=dataset;B. data=dataset;C. set dataset;D. read dataset;2. 在SAS中,以下哪个函数用于计算数据集的中位数?A. meanB. medianC. modeD. sum3. 如果需要在SAS中对数据进行排序,应该使用哪个过程?A. proc means;B. proc sort;C. proc print;D. proc univariate;4. 在SAS中,如何创建一个新的数据集?A. 使用proc step过程B. 使用data step过程C. 使用proc print过程D. 使用proc means过程5. SAS中,哪个语句用于将两个数据集合并?A. mergeB. appendC. combineD. join6. 在SAS中,如何将一个变量的值赋给另一个变量?A. setB. assignC. putD. set7. SAS中,哪个函数用于计算数据集的最大值?A. maxB. minC. rangeD. high8. 在SAS中,如何将一个数据集中的数据按特定变量分组?A. 使用by语句B. 使用where语句C. 使用if语句D. 使用select语句9. SAS中,哪个过程用于生成描述性统计量?A. proc means;B. proc print;C. proc univariate;D. proc sort;10. 在SAS中,如何将一个数据集的数据输出到一个新的文件中?A. 使用output out=语句B. 使用print to=语句C. 使用write to=语句D. 使用save to=语句二、简答题(每题5分,共20分)1. 描述SAS中数据步(data step)的主要功能,并给出一个简单的示例。

sas练习题(打印版)

sas练习题(打印版)

sas练习题(打印版)### SAS练习题(打印版)#### 一、基础数据操作1. 数据导入- 题目:使用SAS导入一个CSV文件,并列出前5个观测值。

- 答案:使用`PROC IMPORT`过程导入数据,并用`PROC PRINT`展示前5个观测。

2. 数据筛选- 题目:筛选出某列数据大于50的所有观测。

- 答案:使用`WHERE`语句进行筛选。

3. 数据分组- 题目:根据某列数据对数据集进行分组,并计算每组的均值。

- 答案:使用`PROC MEANS`过程和`BY`语句进行分组和计算。

4. 数据排序- 题目:按照某列数据的升序或降序对数据集进行排序。

- 答案:使用`PROC SORT`过程进行排序。

#### 二、描述性统计分析1. 单变量分析- 题目:计算某列数据的均值、中位数、标准差等统计量。

- 答案:使用`PROC UNIVARIATE`过程进行单变量描述性统计分析。

2. 频率分布- 题目:计算某列数据的频数和频率分布。

- 答案:使用`PROC FREQ`过程进行频率分布分析。

3. 相关性分析- 题目:计算两列数据的相关系数。

- 答案:使用`PROC CORR`过程计算相关系数。

#### 三、假设检验1. t检验- 题目:对两组独立样本的均值进行t检验。

- 答案:使用`PROC TTEST`过程进行t检验。

2. 方差分析- 题目:对多个组别数据进行方差分析。

- 答案:使用`PROC ANOVA`过程进行方差分析。

3. 卡方检验- 题目:对分类变量进行卡方检验。

- 答案:使用`PROC FREQ`过程和`CHI2TEST`选项进行卡方检验。

#### 四、回归分析1. 简单线性回归- 题目:使用一个自变量和一个因变量进行简单线性回归分析。

- 答案:使用`PROC REG`过程进行简单线性回归。

2. 多元线性回归- 题目:使用多个自变量和一个因变量进行多元线性回归分析。

- 答案:同样使用`PROC REG`过程,但包括多个自变量。

SAS统计软件知识要点与试题库

SAS统计软件知识要点与试题库

SAS 统计软件知识要点与试题库1. 试述SAS系统中PGM、EDITOR、OUTPUT、EXPLORER、RESULT和LOG窗口的功能。

2. 窗口切换(移至前台并击活)可用以下任一种做法实现:(1)点击窗口本身;(2)由菜单项“窗口(W)”可切换到已打开的窗口,或由查看(View)加入新窗口;(3) Ctrl + T ab 依次切换;(4) 用设置的热键; (5) 发布命令;(6) 点击窗口条中某一窗口图标.3. 发布命令有四种方式:在命令框直接键入命令;使用下拉菜单(弹出菜单);使用工具条;按功能键(KEYS命令显示功能键所表示的命令).4. SAS数据集可以读取的数据类型:数据行直接输入、流行的数据库、其它文件格式5. SAS数据集的描述部分(创建与修改日期,引擎,变量名,类型,长度,标题,格式等)6. 字符型变量的缺失值用空格符表示数值型变量的缺失值用句号“ . ”表示7. SAS逻辑库包括临时库、永久库两种,区别?8. ViewT able窗口提供两种打开数据的方式:Browse模式和Edit模式,区别?9. SAS数据集的变量属性有6个,哪六个?(变量名及标签,类型,长度,输入输出格式).10. 在SAS系统中浏览和编辑SAS数据集一般必须先设定SAS逻辑库(文件库),然后将要浏览和编辑的数据集存放在已设定的SAS逻辑库(文件库)中.11. 多个SAS逻辑库可与同一个物理位置项连接;一个SAS逻辑库也可与多个物理位置相连接.12. 新建逻辑库(New Library)的方法:1. 按工具条上图标(New Library)可进入设定新的SAS逻辑库的N ew Library窗口;2. 资源管理器(浏览器)窗口击活时,在下拉菜单中选:文件(File) ⇒新建(New… )⇒逻辑库=>可进入设定新建逻辑库(New Library)窗口.3. 在“SAS 环境”(Environment)处击右键,在弹出的菜单中选新建(New …)=>逻辑库,也可进入新建逻辑库(New Library)窗口.13. 上机试题(1).用菜单方法建立新库(库标志名为dsta),此库包含本课程所使用的sas数据集; (2).用两种方法(菜单或命令)进入ViewT able窗口,并浏览数据集class;(3)先浏览class中SEX=…F‟的观测及AGE>=14的观测,然后浏览全部观测;(4)浏览数据集class的描述信息和数据内容;(5)浏览SAS永久库SASUSER的属性和内容,并浏览数据集AIR的描述信息和数据内容.14. 数据集名应由字母或下划线开始且不超过32个(V6为8) 个字节的字符、数字或下划线构成. 变量名,数组名,库名15. 上机(1). 用VT命令进入ViewT able窗口,直接输入数据并进行编辑修改后存为sas数据集; (2). 使用Import窗口菜单系统,将*.txt 转换为sas数据集;(3). 用数据步建立SAS数据集.16. SAS的Import/Export菜单界面提供一个使用菜单的图形界面:17. SAS语句书写的格式较为灵活:语句可以在某一行的任何位置开始和结束;词间可任意加入空格和换行;一个语句可以写成几行,只要语句中的单词不被断开就可以;多个语句可写在一行;SAS语句用大写字母、小写字母或两者混合书写均可以.18. 通常用DAT A步产生SAS数据集,而用PROC步对SAS数据集中的数据进行分析处理并输出结果. 一个SAS程序可由一个DAT A步或一个PROC步组成;或者由DAT A 步和PROC步两部分组成;也可由多个DAT A步和PROC步组成.19. SAS的字符型变量缺省的长度是8个字符,可以用LENGTH语句直接指定变量长度。

sas期末考试试题

sas期末考试试题

sas期末考试试题SAS期末考试试题一、选择题(每题2分,共20分)1. 在SAS中,以下哪个命令用于创建数据集?A. PROC SORTB. DATASETSC. SETD. INPUT2. 下列哪个选项不是SAS数据集中的变量属性?A. 长度B. 格式C. 标签D. 颜色3. SAS中的PROC FREQ过程用于:A. 描述性统计分析B. 频率分布分析C. 回归分析D. 时间序列分析4. 以下哪个命令用于在SAS中生成随机数?A. RANDB. RANDOMC. RNDD. UNIVARIATE5. 在SAS中,如何使用PROC GPLOT创建图形?A. 使用PLOT语句B. 使用SGPLOT过程C. 使用GPLOT语句D. 使用GRAPH语句二、简答题(每题10分,共30分)1. 解释SAS中的宏语言及其用途。

2. 描述如何使用SAS进行数据清洗的基本步骤。

3. 简述SAS中PROC UNIVARIATE过程的功能和应用场景。

三、编程题(每题25分,共50分)1. 编写SAS程序,从一个名为“sales_data”的数据集中提取出所有销售额超过平均销售额的产品,并计算这些产品的总销售额。

```sasdata sales_data;set sales_data;if sales > mean(sales);run;proc means data=sales_data mean;var sales;output out=avg_sales mean=avg_sales;run;data top_sales;set sales_data;where sales > avg_sales.avg_sales;run;proc sql;select sum(sales) into: total_salesfrom top_sales;quit;```2. 编写SAS程序,使用PROC REG过程对一个名为“education_data”的数据集进行线性回归分析,预测学生的考试成绩(变量名为“score”)基于其学习时间(变量名为“study_hours”)。

sas 面试题

sas 面试题

sas 面试题SAS面试题SAS(Statistical Analysis System)是一种广泛使用的统计分析软件,它提供了强大的数据分析和管理工具。

在求职过程中,面试官通常会提出各种关于SAS的问题,以评估面试者对该软件的熟悉程度和应用能力。

本文将介绍一些常见的SAS面试题,帮助读者更好地准备SAS相关的面试。

一、基础问题1. 什么是SAS?它有什么功能?SAS是一种基于GUI的统计分析软件,用于数据的管理、分析和预测。

它具有数据访问、数据转换、数据建模和数据可视化等功能。

2. 如何导入数据到SAS中?可以使用DATA步骤或者PROC IMPORT命令导入数据到SAS中。

DATA步骤适用于手动编写SAS代码导入数据,PROC IMPORT命令适用于自动从外部文件导入数据。

3. 如何选择变量?可以使用DATA步骤中的DROP和KEEP子语句来选择变量。

DROP子语句用于删除不需要的变量,KEEP子语句用于保留指定的变量。

4. 如何对数据进行排序?可以使用PROC SORT命令对数据进行排序。

可以通过指定BY子句来选择一个或多个变量作为排序依据。

二、高级问题1. 什么是宏变量?如何定义和使用宏变量?宏变量是一种可以在SAS程序中使用和定义的变量,它起到类似于替代符号的作用。

可以使用%LET语句来定义宏变量,并使用&符号来引用宏变量。

2. 如何创建SAS数据集?可以使用DATA步骤和SET语句来创建SAS数据集。

DATA步骤用于创建新的数据集,SET语句用于将已有数据集导入到当前数据集。

3. 如何进行数据转换?可以使用DATA步骤中的IF、WHERE、RENAME和FORMAT等语句来进行数据转换。

IF和WHERE语句用于筛选数据行,RENAME语句用于修改变量名,FORMAT语句用于改变变量的格式。

4. 如何进行数据合并?可以使用DATA步骤中的MERGE和JOIN语句来进行数据合并。

sas考试题库及答案

sas考试题库及答案

sas考试题库及答案1. 在SAS中,如何使用`proc print`步骤来输出数据集的前几行?A. 使用`proc print data=dataset;`命令B. 使用`proc print data=dataset firstobs=5;`命令C. 使用`proc print data=dataset first=5;`命令D. 使用`proc print data=dataset top;`命令正确答案是B。

2. 如果想要在SAS中创建一个数据集,并将某个变量的值替换为缺失值,应该如何操作?A. 使用`data`步骤和`if`语句B. 使用`data`步骤和`replace`函数C. 使用`proc sql`步骤D. 使用`proc means`步骤正确答案是A。

3. 在SAS中,如何将一个数据集的列名从`Var1`更改为`Variable1`?A. 使用`rename`语句:`rename Var1=Variable1;`B. 使用`rename`语句:`rename Variable1=Var1;`C. 使用`proc contents`步骤D. 使用`proc print`步骤正确答案是A。

4. 如何在SAS中使用`proc means`步骤来计算数据集的描述性统计量?A. 使用`proc means data=dataset;`命令B. 使用`proc means data=dataset N NMISS MEAN MEDIAN MAX MIN;`命令C. 使用`proc means data=dataset out=means;`命令D. 使用`proc means data=dataset out=means N NMISS MEAN MEDIAN MAX MIN;`命令正确答案是D。

5. 在SAS中,如何使用`proc sort`步骤对数据集进行排序?A. 使用`proc sort data=dataset;`命令B. 使用`proc sort data=dataset out=sorted_dataset;`命令C. 使用`proc sort data=dataset by variable;`命令D. 使用`proc sort data=dataset out=sorted_dataset by variable;`命令正确答案是D。

SAS认证考试(官方练习题集和校正答案)

SAS认证考试(官方练习题集和校正答案)

1. A raw data file is listedbelow.The following program issubmitted using this file asinput:data work.family;infile 'file-specification';<insert INPUTstatement here>run;Which INPUT statementcorrectly reads the values forthe variable Birthdate asSAS date values?a.input relation$ first_name$ birthdate date9.;b.input relation$ first_name$ birthdatemmddyy8.;c.input relation$ first_name$ birthdate :date9.;d.input relation$ first_name$ birthdate :mmddyy8.;Correct answer: dAn informat is used to translate the calendar date to a SAS datevalue. The date values are in the form of two-digit values formonth-day-year, so the MMDDYY8. informat must be used.When using an informat with list input, the colon-formatmodifier is required to correctly associate the informat with thevariable name.You can learn about•informats in Reading Date and Time Values•the colon-format modifier in Reading Free-FormatData.2. A raw data file is listed below.1---+----10---+----20---+---Jose,47,210Sue,,108The following SAS program is submitted using the raw data fileabove as input:data employeestats;<insert INFILE statement here>input name $ age weight;run;The following output is desired:name age weightJose47210Sue.108Which of the following INFILE statements completes theprogram and accesses the data correctly?a.infile 'file-specification' pad;b.infile 'file-specification' dsd;c.infile 'file-specification' dlm=',';d.infile 'file-specification' missover;Correct answer: bThe PAD option specifies that SAS pad variable length recordswith blanks. The MISSOVER option prevents SAS fromreading past the end of the line when reading free formatteddata. The DLM= option specifies the comma as the delimiter;however, consecutive delimiters are treated as one by default.The DSD option correctly reads the data with commas asdelimiters and two consecutive commas indicating a missingvalue like those in this raw data file.You can learn about•the PAD option in Reading Raw Data in Fixed Fields•the MISSOVER option in Creating MultipleObservations from a Single Record•the DLM= option and the DSD option in Reading Free-Format Data.3. The following program is submitted:data numrecords;infile cards dlm=',';input agent1 $ agent2 $ agent3 $;cards;jones,,brownjones,spencer,brown;run;What is the value for the variable named Agent2 in the secondobservation?a.Brownb.Spencerc.' ' (missing character value)d.There is no value because only one observation iscreated.Correct answer: dThe CARDS statement enables you to read instream data. Anynumber of consecutive commas are considered to be a singledelimiter as a result of the DLM= option, and the length of eachvariable defaults to 8 bytes. Therefore, the values jones,brownjon, and spencer are assigned to Agent1, Agent2, andAgent3, respectively, for the first observation. The rest of thedata on the record is not read by the INPUT statement and is notoutput to the data set.You can learn about•the CARDS statement in Creating SAS Data Sets fromRaw Data•the default length of variables in Reading Free-FormatData.4. A raw data file is listed below.1---+----10---+----20---+----30---+----40---+----50TWOSTORY 1040 2 1SANDERS ROAD $55,850CONDO 2150 4 2.5JEANS AVENUE $127,150The following program is submitted using this file as input:data work.houses;infile 'file-specification';<insert INPUT statement here>run;Which one of the following INPUT statements reads the rawdata file correctly?a.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street 16.@40 price dollar8;b.input @1 style $8+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street $16@40 price dollar8.;c.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3.street $16.@40 price dollar8.;d.input @1 style $8.+1 sqfeet 4.+1 bedrooms 1.@20 baths 3street 16.@40 price dollar8.;Correct answer: cFormatted input requires periods as part of the informat name.The period is missing from the variables Style and Street inAnswer b, the variable Baths in Answer d, and the variablePrice in Answer a (which is also missing a dollar sign to readthe variable Street as a character value).You can learn about formatted input and informats in ReadingRaw Data in Fixed Fields.5. The following SAS program is submitted at the start of a newSAS session:libname sasdata 'SAS-data-library';data sasdata.sales;set sasdata.salesdata;profit=expenses-revenues;run;proc print data=sales;run;The SAS data set Sasdata.Salesdata has ten observations.Which one of the following explains why a report fails togenerate?a.The DATA step fails execution.b.The SAS data set Sales does not exist.c.The SAS data set Sales has no observations.d.The PRINT procedure contains a syntax error.Correct answer: bThe DATA step creates a permanent SAS data set,Sasdata.Salesdata. The PRINT procedure is printing atemporary SAS data set, Sales, that is stored in the Worklibrary. At the beginning of the SAS session, Work.Sales doesnot exist.You can learn about•creating permanent data sets with the DATA step inCreating SAS Data Sets from Raw Data•temporary data sets in Basic Concepts.6. Which action assigns a reference named SALES to a permanentSAS data library?a.Issuing the command:libref SALES 'SAS-data-library'b.Issuing the command:libname SALES 'SAS-data-library'c.Submitting the statement:libref SALES 'SAS-data-library';d.Submitting the statement:libname SALES 'SAS-data-library';Correct answer: dThe LIBNAME statement assigns a reference known as a librefto a permanent SAS data library. The LIBNAME commandopens the LIBNAME window.You can learn about the LIBNAME statement in ReferencingFiles and Setting Options.7. The following SAS program is submitted:data newstaff;set staff;<insert WHERE statement here>run;Which one of the following WHERE statements completes theprogram and selects only observations with a Hire_date ofFebruary 23, 2000?a.where hire_date='23feb2000'd;b.where hire_date='23feb2000';c.where hire_date='02/23/2000'd;d.where hire_date='02/23/2000';Correct answer: aA SAS date constant must take the form of one- or two-digitday, three-digit month, and two- or four-digit year, enclosed inquotation marks and followed by a d ('ddmmmyy<yy>'d).You can learn about SAS date constants in Creating SAS DataSets from Raw Data.8. Which one of the following SAS date formats displays the SASdate value for January 16, 2002 in the form of 16/01/2002?a.DATE10.b.DDMMYY10.c.WEEKDATE10.d.DDMMYYYY10.Correct answer: bThe requested output is in day-month-year order and is 10 byteslong, so DDMMYY10. is the correct format. AlthoughWEEKDATE10. is a valid SAS format, it does not display theSAS date value as shown in the question above.DDMMYYYY10. is not a valid SAS date format, and theDATE w. format cannot accept a length of 10.You can learn about•the DDMMYY10. format in Creating List Reports•the WEEKDATE10. format in Reading Date and TimeValues.9. Which one of the following displays the contents of an externalfile from within a SAS session?a.the LIST procedureb.the PRINT procedurec.the FSLIST procedured.the VIEWTABLE windowCorrect answer: cThe PRINT procedure and VIEWTABLE window display thevalues in SAS data sets. The FSLIST procedure displays thevalues in external files. There is no LIST procedure in SAS.You can learn about•the PRINT procedure in Creating List Reports•the VIEWTABLE window in Referencing Files andSetting Options.10. The SAS data set Sashelp.Prdsale contains the variablesRegion and Salary with 4 observations per Region.Sashelp.Prdsale is sorted primarily by Region and withinRegion by Salary in descending order.The following program is submitted:data one;set sashelp.prdsale;retain temp;by region descending salary;if first.region thendo;temp=salary;output;end;if last.region thendo;range=salary-temp;output;end;run;For each region, what is the number of observation(s) written tothe output data set?a.0b.1c. 2d.4Correct answer: cThe expression first.region is true once for each regiongroup. The expression last.region is true once for each regiongroup. Therefore, each OUTPUT statement executes once for atotal of 2 observations in the output data set.You can learn about the FIRST.variable expression and theOUTPUT statement in Reading SAS Data Sets.11. The following SAS program is submitted:proc contents data=sasuser.houses;run;The exhibit below contains partial output produced by theCONTENTS procedure.Data Set Name SASUSER.HOUSES Observations15Member Type DATA Variables6Engine V9Indexes0Created Tuesday, April 22,2003 03:09:25 PMObservationLength56Last Modified Tuesday, April 22,2003 03:09:25 PMDeletedObservationsProtection Compressed NO Data Set Type Sorted NOLabel Residential housing for saleDataRepresentationWINDOWS_32Encoding wlatin1 Western (Windows)Which of the following describes the Sasuser.Houses data set?a.The data set is sorted but not indexed.b.The data set is both sorted and indexed.c.The data set is not sorted but is indexed.d.The data set is neither sorted nor indexed.Correct answer: dThe exhibit above shows partial output from the CONTENTSprocedure, In the top right-hand column of the output, you seethat Indexes has a value of 0, which indicates that no indexesexist for this data set. Also, Sorted has a value of NO, whichindicates that the data is not sorted.You can learn about the CONTENTS procedure in ReferencingFiles and Setting Options.12. The following SAS program is submitted:proc sort data=work.test;by fname descending salary;run;Which one of the following represents how the observations aresorted?a.The data set Work.Test is stored in ascending order byboth Fname and Salary values.b.The data set Work.Test is stored in descending order byboth Fname and Salary values.c.The data set Work.Test is stored in descending order byFname and ascending order by Salary values.d.The data set Work.Test is stored in ascending order byFname and in descending order by Salary values.Correct answer: dThe DESCENDING keyword is placed before the variable nameit modifies in the BY statement, so the correct description is indescending order by Salary value within ascending Fnamevalues.You can learn about the SORT procedure and theDESCENDING keyword in Creating List Reports.13. The following SAS program is submitted:data names;title='EDU';if title='EDU' thenDivision='Education';else if title='HR' thenDivision='Human Resources';else Division='Unknown';run;Which one of the following represents the value of the variableDivision in the output data set?catiocationc.Human Red.Human ResourcesCorrect answer: bThe length of the variable Division is set to 9 when the DATAstep compiles. Since the value of the variable Title is EDU, thefirst IF condition is true; therefore, the value of the variableDivision is Education.You can learn about•the length of a variable in Understanding DATA StepProcessing•IF-THEN statements in Creating and ManagingVariables.14. Which one of the following SAS programs creates a variablenamed City with a value of Chicago?a.data work.airports;AirportCode='ord';if AirportCode='ORD' City='Chicago';run;b.data work.airports;AirportCode='ORD';if AirportCode='ORD' City='Chicago';run;c.data work.airports;AirportCode='ORD';if AirportCode='ORD' then City='Chicago';run;d.data work.airports;AirportCode='ORD';if AirportCode='ORD';then City='Chicago';run;Correct answer: cThe correct syntax for an IF-THEN statement is: IF expressionTHEN statement;In this example, the variable City is assigned a value ofChicago only if the expression AirportCode='ORD' is true.You can learn about IF-THEN statements in Creating andManaging Variables.15. The following SAS program is submitted:data work.building;code='DAL523';code='SANFRAN604';code='HOUS731';length code $ 20;run;Which one of the following is the length of the code variable?a.6b.7c.10d.20Correct answer: aThe DATA step first goes through a compilation phase, then anexecution phase. The length of a variable is set during thecompilation phase and is based on the first time the variable isencountered. In this case, the variable code is set to the lengthof the text string DAL523 which is 6 characters long. The nextassignment statements are ignored during compilation. TheLENGTH statement is also ignored since the length has alreadybeen established, but a note will be written to the log.You can learn about•the compilation phase of the DATA step inUnderstanding DATA Step Processing•the LENGTH statement in Creating and ManagingVariables.16. Which of the following statements creates a numeric variablenamed IDnumber with a value of 4198?a.IDnumber=4198;b.IDnumber='4198';c.length IDnumber=8;d.length IDnumber $ 8;Correct answer: aThe first reference to the SAS variable in the DATA step setsthe name, type, and length of the variable in the program datavector (PDV) and in the output SAS data set. The assignmentstatement IDnumber=4198; is the first reference and creates anumeric variable named IDnumber with a default storage lengthof 8 bytes.You can learn about•creating variables in the DATA step in UnderstandingDATA Step Processing•numeric variables in Basic Concepts.17. The following program is submitted:data fltaten;input jobcode $ salary name $;cards;FLAT1 70000 BobFLAT2 60000 JoeFLAT3 30000 Ann;run;data desc;set fltaten;if salary>60000 then description='Over 60';else description='Under 60';run;What is value of the variable named description when thevalue for salary is 30000?a.Under 6b.Under 60c.Over 60d.' ' (missing character value)Correct answer: aThe variable description is being created by the IF-THEN/ELSE statement during compilation. The first occurrenceof the variable description is on the IF statement, and since itis assigned the value Over 60, the length of the variable is 7.Therefore, for the salary value of 30000, description has thevalue of Under 6 (the 0 is truncated.)You can learn about•the compilation phase of the DATA step inUnderstanding DATA Step Processing•IF-THEN/ELSE statements in Creating and ManagingVariables.18. A raw data file is listed below.1---+----10---+----20---+---102320The following program is submitted:data all_sales;infile 'file-specification';input receipts;<insert statement(s) here>run;Which statement(s) complete(s) the program and produce(s) arunning total of the Receipts variable?a.total+receipts;b.total 0;sum total;c.total=total+receipts;d.total=sum(total,receipts);Correct answer: aThe SUM function and the assignment statement do not retainvalues across iterations of the DATA step. The sum statementtotal+receipts; initializes total to 0, ignores missing valuesof receipt, retains the value of total from one iteration to thenext, and adds the value of receipts to total.You can learn about the sum statement in Creating andManaging Variables.19. A raw data file is listed below.1---+----10---+----20---+---1901 21905 11910 61925 11941 1The following SAS program is submitted and references the rawdata file above:data money;infile 'file-specification';input year quantity;total=total+quantity;What is the value of total when the data step finishesexecuting?a.0b.1c.11d. . (missing numeric value)Correct answer: dThe variable Total is assigned a missing value during thecompilation phase of the DATA step. When the first record isread in, SAS processes: total=.+2; which results in a missingvalue. Therefore the variable Total remains missing for allobservations.You can learn about•the compilation phase of the DATA step inUnderstanding DATA Step Processing•using missing values with arithmetic operators inCreating 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.0b.3c.4d. . (missing numeric value)Correct answer: cThe MEAN function adds all of the non-missing values anddivides 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 Datawith 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 inthe output data set?a.( 3)b.(312)c.3d.312Correct answer: aAn automatic data conversion is performed whenever a numericvariable is used where SAS expects a character value. Thenumeric variable is written with the BEST12. format and theresulting character value is right-aligned when the conversionoccurs. In this example, the value of Phonenumber is convertedto character and right-aligned before the SUBSTR function isperformed. Since there are only 10 digits in the value ofPhonenumber, 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 blanksand a 3.You can learn about automatic data conversion and theSUBSTR function in Transforming Data with SAS Functions.22. The following SAS program is submitted:data work.inventory;products=7;do until (products gt 6);products+1;end;run;Which one of the following is the value of the variableproducts in the output data set?a.5b.6c.7d.8Correct answer: dA DO UNTIL loop always executes at least once because thecondition is not evaluated until the bottom of the loop. In theSAS program above, the value of Products is incremented from7 to 8 on the first iteration of the DO UNTIL loop, before thecondition is checked. Therefore the value of Products is 8.You can learn about DO UNTIL loops in Generating Datawith DO Loops.23. The following program is submitted:data work.test;set work.staff (keep=salary1 salary2 salary3);<insert ARRAY statement here>run;Which ARRAY statement completes the program and createsnew 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: bAlthough each of the ARRAY statements listed above is a validstatement, only Answer B creates new variables namednew_salary1, new_salary2 and new_salary3. Answer C andAnswer D both create an array that groups the existing data setvariables salary1, salary2, and salary3. Since the array inAnswer A is named salary, it also uses the existing data setvariables.You can learn about creating new variables in an ARRAYstatement in Processing Variables with Arrays.24. Which of the following permanently associates a format with avariable?a.the FORMAT procedureb.a FORMAT statement in a DATA stepc.an INPUT function with format modifiersd.an INPUT statement with formatted style inputCorrect answer: bTo permanently associate a format with a variable, you use theFORMAT statement in a DATA step. You can use theFORMAT procedure to create a user-defined format. You usethe INPUT function to convert character data values to numericvalues with an informat. You use the INPUT statement to readdata into a data set with an informat.You can learn about•permanently assigning a format to a variable in Creatingand Managing Variables•the FORMAT statement in Creating List Reports•the FORMAT procedure in Creating and ApplyingUser-Defined Formats•the INPUT function in Transforming Data with SASFunctions•the INPUT statement in Reading Raw Data in FixedFields.25. The following report is generated:Which of the following steps created the report?a.proc freq data=sasuser.houses;tables style price /nocum;format price dollar10.;label style="Style of homes"price="Asking price";run;b.proc print data=sasuser.houses;class style;var price;table style,n price*mean*f=dollar10.;label style="Style of homes"price="Asking price";run;c.proc means data=sasuser.houses n mean;class style;var price;format price dollar10.;label style="Style of homes"price="Asking price";run;d.proc report data=sasuser.houses nowd headline;column style n price;define style / group "Style of homes";define price / mean format=dollar8."Asking price";run;Correct answer: dThe FREQ procedure cannot create the average asking price.The CLASS statement and the VAR statement are not valid foruse with the PRINT procedure. The MEANS procedure outputwould have both the N statistic and the N Obs statistic since aCLASS statement is used. The REPORT procedure producedYou can learn about•the FREQ procedure in Producing DescriptiveStatistics•the PRINT procedure in Creating List Reports•the MEANS procedure in Producing DescriptiveStatistics•the REPORT procedure in Creating Enhanced List andSummary Reports.26. A SAS report currently flows over two pages because it is toolong to fit within the specified display dimension. Which one ofthe following actions would change the display dimension sothat 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: dThe PAGESIZE= SAS system option controls the number oflines that compose a page of SAS procedure output. Byincreasing the number of lines available per page, the reportmight fit on one page.You can learn about the PAGESIZE= option in ReferencingFiles and Setting Options.27. Which one of the following SAS REPORT procedure optionscontrols how column headings are displayed over multiplelines?a.SPACE=BEL=d.BREAK=Correct answer: bThe SPLIT= option specifies how to split column headings. TheSPACE=, LABEL= and BREAK= options are not valid optionsin PROC REPORT.You can learn about the SPLIT= option for the REPORTprocedure in Creating Enhanced List and Summary Reports.28. The following SAS program is submitted:ods html file='newfile.html';proc print data=sasuser.houses;run;proc means data=sasuser.houses;run;proc freq data=sasuser.shoes;run;ods html close;proc print data=sasuser.shoes;run;How many HTML files are created?a.1b.2c. 3d.4Correct answer: aBy default, one HTML file is created for each FILE= option orBODY= option in the ODS HTML statement. The ODS HTMLCLOSE statement closes the open HTML file and ends theoutput capture. The Newfile.html file contains the output fromthe PRINT, MEANS, and FREQ procedures.You can learn about the ODS HTML statement in ProducingHTML Output.29. A frequency report of the variable Jobcode in the Work.Actorsdata set is listed below.Jobcode Frequency Percent CumulativeFrequencyCumulativePercentActor I233.33233.33 Actor II233.33466.67 Actor III233.336100.00Frequency Missing = 1The following SAS program is submitted:data work.joblevels;set work.actors;if jobcode in ('Actor I', 'Actor II') thenjoblevel='Beginner';if jobcode='Actor III' thenjoblevel='Advanced';else joblevel='Unknown';run;Which of the following represents the possible values for the variable joblevel in the Work.Joblevels data set?a.Advanced and Unknown onlyb.Beginner and Advanced onlyc.Beginner, Advanced, and Unknownd.' ' (missing character value)Correct answer: aThe DATA step will continue to process those observations that satisfy the condition in the first IF statement Although Joblevel might be set to Beginner for one or more observations, the condition on the second IF statement willevaluate as false, and the ELSE statement will execute and overwrite the value of Joblevel as Unknown.You can learn about•the IF statement in Creating SAS Data Sets from RawData•the ELSE statement in Creating and ManagingVariables.30. The descriptor and data portions of the Work.Salaries data setare shown below.Variable Type Len Posname Char80salary Char816status Char88name status salaryLiz S15,600Herman S26,700Marty S35,000The following SAS program is submitted:proc print data=work.salaries;where salary<20000;run;What is displayed in the SAS log after the program is executed?a.A NOTE indicating that 1 observation is read.b.A NOTE indicating that 0 observations were read.c.A WARNING indicating that character values have beenconverted to numeric values.d.An ERROR indicating that the WHERE clause operatorrequires compatible variables.Correct answer: dSalary is defined as a character variable. Therefore, the valuein the WHERE statement must be the character value 20,000enclosed in quotation marks.You can learn about the WHERE statement in Creating ListReports.31. Which of the following statements is true when SAS encountersa syntax error in a DATA step?a.The SAS log contains an explanation of the error.b.The DATA step continues to execute and the resultingdata set is complete.c.The DATA step stops executing at the point of the errorand the resulting data set contains observations up to thatpoint.d.A note appears in the SAS log indicating that theincorrect statement was saved to a SAS data set forfurther examination.Correct answer: aSAS scans the DATA step for syntax errors during thecompilation phase. If there are syntax errors, those errors getwritten to the log. Most syntax errors prevent further processingof the DATA step.You can learn about how SAS handles syntax errors in theDATA step in Understanding DATA Step Processing.32. Which TITLE statement would display JANE'S DOG as the textof the title?a.title "JANE"S DOG";b.title 'JANE"S DOG';c.title "JANE'S DOG";d.title 'JANE' ' 'S DOG';Correct answer: c。

2021年SAS大赛初赛试题

2021年SAS大赛初赛试题

2021年SAS大赛初赛试题sas数据分析大赛试题注意:建立逻辑库test保存所有原始数据集,每道题要将代码和运行结果保存在word文档中。

1、(20分)a600605所给数据中包含上证股票600605,1995-2001年的行情信息。

其数据信息如下所示。

[题目建议]1)使用data步计来计算a600605这支股票在1995-1998年的市场收益,即该股票的月收益率为(个股月收益率=[(本月收盘价-上月收盘价)/上月收盘价]×100%),过程中不要采用dif和lag函数。

其中date的格式设置为‘1995-01’的形式,并删掉1995年1月的观测数据。

2)编写graph,绘制a600605这支股票的收益率曲线,横坐标标签改为“日期”,纵坐标标签下改成“月收益率”2、(30分)数据集credit_old中存放的是用于构建客户信用模型的数据,其中target为被解释变量,其他变量为解释变量。

由于字符变量不能用于后续的统计分析工作,因此需要将credit_model中的字符变量重编码为数值变量。

由于分析时并不关心每个水平的具体编码是什么,因此按照从1到k(k为该变量水平数)编码即可,比如res变量一共用3个水平,分别是u、r、s,编码为1、2、3即可。

但是需要使用宏进行自动处理。

[题目建议]1)将test库下的credit_old数据集复制到work逻辑库下,并重命名为credit_new。

(5分)2)使用数据字典读取credit_new数据集下所有解释变量中的字符变量的个数和名称。

(10分后)3)编写宏,为每一个字符变量重新编码,以“变量名_cd”的命名方式保存新的编码,并嵌入至原credit_new数据集的后面,效果如下:(15分后)3、(25分)数据集base来源于一个全国性的社会学调查的一部分,采集了受访者对于一些社会问题的感受。

变量标签变量q8q22q3f标签您指出您的收入水平在整个社会中处在何种边线?就目前社会环境来说,您指出凭个人努力可以赢得较好发展的期望存有多小?贫富差距不断扩大age10年龄组weight权数所有的数据除了weight之外,全部就是等级数据,分值越高意味著评价越负面。

SAS期末试题及答案解析

SAS期末试题及答案解析

5月31日上机作业:《统计分析系统SAS》模拟练习,结果不用上传保险公司为了解车险投保人对保险公司工作的满意程度Y和投保人的年龄X1、事故的严重程度X2及投保人的焦虑程度X3之间的关系,随机调查了该保险公司的23位报险人,得到数据表如下。

将数据作变换:将X2与Y数据上加上你学号的后1位,如学号的最后一位数据为2,则第1位报险人的X2=51+2,Y=48+2,其余数据依此类推。

一、数据集的建立1. 简述建立数据集时,SAS逻辑库的作用2. 若在D盘根目录建立了一个名字为“AA”的逻辑库,,上述数据集名字为temp,在windows 环境下数据集全名为_ ,SAS环境下,数据集名字的完整表示为_ 。

二、基本统计分析1.INSIGHT中,得到变量X2的均值为_ ,标准差为_ ,变异系数为_ _,方差为为__ 2.变量Y的的均值为_ ,标准差为_ ,变异系数为_ _,方差为为_ _。

三、正态性检验对数据进行正态性检验,以0.1为显著性水平进行检验,得到的结果中,变量为正态分布,为非正态分布;变量Y的中位数为,数据中有25%的值小于。

四、相关分析1.变量X1和Y的相关系数为R= ,X2和Y的相关系数R=,X3和Y的相关系数R=,X2和X3的相关系数R= 。

2. 写出用相关系数说明问题时,要注意的几点,至少写出3点。

(答案供参考)答:1)相关系数很强并不表示变量间一定有因果关系,也可能是两个变量同时受第三个变量的影响而使他们有很强的相关;2)相关系数是说明线性联系程度的。

相关系数接近于0的变量间可能存在非线性联系(可能是曲线关系);3)有时个别极端数据可能影响相关系数;4)强相关并不表示一定存在因果关系;5)弱相关并不表示变量间不存在关系。

五、假设检验1.简述假设检验的基本思想。

在假设检验中,P值的含义是什么?(答案供参考)答:首先给定一个原假设H0,H0是关于总体参数的表述,与此同时存在一个与H0相对立的备择假设H1,H0与H1有且仅有一个成立;经过一次抽样,若发生了小概率事件(通常把概率小于0.05的事件称为小概率事件),可以依据“小概率事件在一次实验中几乎不可能发生”的理由,怀疑原假设不真,作出拒绝原假设H0,接受H1的决定;反之,若小概率事件没有发生,就没有理由拒绝H0,从而应作出拒绝H1的决定。

sas测试题

sas测试题

sas测试题SAS(Statistical Analysis System)是一种广泛使用的统计分析软件,它提供了一系列数据分析和统计建模的功能。

本篇文章将围绕SAS测试题展开,就以下几个方面进行介绍和讨论:SAS基础知识、SAS数据的处理、SAS的统计分析和SAS的数据可视化。

一、SAS基础知识在开始探讨SAS测试题之前,先来了解一些SAS的基础知识。

SAS软件由多个组件组成,包括数据步骤(Data Step)和过程步骤(Procedure Step)。

数据步骤用于读取、转换和处理数据,而过程步骤用于执行统计分析和生成报告。

SAS程序由一系列语句和过程组成,语句以分号结尾,每个过程由一个或多个语句组成。

在SAS语言中,使用“=”运算符进行赋值,使用“*”运算符表示乘法,使用“/”运算符表示除法。

此外,SAS还支持各种不同类型的数据,包括字符型、数字型、日期型等。

二、SAS数据的处理SAS具有强大的数据处理功能,可以读取和处理各种格式的数据。

在SAS中,可以使用DATA步骤来读取和处理数据集。

通过使用各种DATA步骤中的语句和函数,可以对数据集进行排序、过滤、拆分和合并等操作。

在SAS中,使用PROC步骤来执行各种统计分析。

通过PROC步骤,可以进行描述统计、频数分析、回归分析等常见的统计分析方法。

此外,SAS还提供了丰富的统计函数,如求和函数、平均值函数、方差函数等,方便用户进行数据分析和计算。

三、SAS的统计分析SAS是一款出色的统计分析软件,提供了多种统计方法和技术。

在SAS中,可以使用PROC步骤执行各种统计分析。

以下是SAS中常用的几种统计分析方法:1. 描述统计:通过使用PROC MEANS和PROC SUMMARY等过程,可以计算数据集的均值、中位数、标准差等统计指标,以便更好地理解数据的特征。

2. 频数分析:通过使用PROC FREQ过程,可以对数据集中的变量进行频数统计和交叉表分析,进一步挖掘变量之间的关系。

统计软件SAS试题及答案(新)

统计软件SAS试题及答案(新)

滨州医学院2010~2011学年第一学期《统计软件》试题(A卷)(考试时间:120分钟,满分:100分)用题班级:2008级统计学专业一、数据库整理:(1题共42分)做题要求:按照要求写出程序,书写要符合SAS程序的规则。

随机抽取8名医学生的基础课程成绩与医学专业课程成绩,其成绩数据如表:医学基础课医学专业课解剖组胚生化生理内科外科妇产儿科X1 X2 X3 X4 Y1 Y2 Y3 Y470 64 97 77 59 81 63 8177 53 72 62 76 82 77 7975 82 66 68 62 75 72 8274 84 84 58 78 79 59 8275 68 73 72 77 81 73 7674 70 94 79 66 93 64 8274 84 86 82 79 79 55 78 (1)用input和cards语句将以上数据建立一个永久性数据集a1,逻辑库名exam,存放路径为’ d:\sas\exam1’,数据库内包含8个变量,分别为8门功课成绩,变量名如表中所示;(8分)libname exam ' d:\sas\exam1';data exam.a1;input X1 X2 X3 X4 Y1 Y2 Y3 Y4 @@;cards;70 64 97 77 59 81 63 8177 53 72 62 76 82 77 7975 82 66 68 62 75 72 8274 84 84 58 78 79 59 8275 68 73 72 77 81 73 7674 70 94 79 66 93 64 8274 84 86 82 79 79 55 7868 83 79 66 80 67 66 78;run;(2)用set语句建立临时性数据集a2,且该数据集不包括外科成绩低于80分的学生成绩;(6分)data a2;set exam.a1;if y2>=80then output a2;run;(3)将(1)中建立的数据集拆分成医学基础课与医学专业课两个数据集,数据集名称分别为exam_base与exam_spe,并将妇产命名为gyn。

统计软件sas期末考试试题及答案

统计软件sas期末考试试题及答案

统计软件sas期末考试试题及答案统计软件SAS期末考试试题一、选择题(每题2分,共20分)1. SAS软件的全称是什么?A. Statistical Analysis SystemB. System Analysis SystemC. System Analysis SoftwareD. Statistical Analysis Software2. 在SAS中,以下哪个命令用于数据集的排序?A. PROC SORTB. PROC MEANSC. PROC FREQD. PROC UNIVARIATE3. 数据集在SAS中通常存储在什么格式的文件中?A. .txtB. .csvC. .sas7bdatD. .dat4. 在SAS中,以下哪个选项用于指定输出数据集?A. IN=变量B. OUT=数据集C. SET=数据集D. DROP=变量5. 以下哪个SAS过程用于描述性统计分析?A. PROC GLMB. PROC TTESTC. PROC CORRD. PROC MEANS6. 在SAS中,如何创建一个新变量?A. 使用IF语句B. 使用CREATE语句C. 使用DEFINE语句D. 使用NEW语句7. SAS编程语言属于哪种类型?A. 过程式编程语言B. 面向对象编程语言C. 函数式编程语言D. 声明式编程语言8. 在SAS中,以下哪个命令用于生成报告?A. PROC REPORTB. PROC PRINTC. PROC TABULATED. PROC FREQ9. 在SAS中,以下哪个选项用于指定数据集的观察顺序?A. ORDER=数据集B. SORT=变量C. ORDERED=变量D. OBS=变量10. SAS软件主要用于哪些领域?A. 数据管理B. 数据分析C. 数据可视化D. 所有以上选项答案:1. A2. A3. C4. B5. D6. A7. A8. A9. B10. D二、简答题(每题10分,共30分)1. 简述SAS软件的主要功能。

SAS BASE 123试题+答案详解

SAS BASE 123试题+答案详解

QUESTION 1In the following SAS program, the input data files are sorted by the NAMES variable:libnametemp 'SAS-data-library';data temp.sales;merge temp.saleswork.receipt;by names;run;Which one of the following results occurs when this program is submitted?A. The program executes successfully and a temporary SAS data set is created.B. The program executes successfully and a permanent SAS data set is created.C. The program fails execution because the same SAS data set is referenced for both read and write operations.D. The program fails execution because the SAS data sets on the MERGE statement are in two different libraries.Answer: BQUESTION 2When the following SAS program is submitted, the data set SASDATA.PRDSALES contains 5000 observations:libnamesastemp 'SAS-data-library';options obs = 500;proc print data = sasdata.prdsales (firsttobs = 100);run;options obs = max;proc means data = sasdata.prdsales (firsttobs = 500);run;How many observations are processed by each procedure?A. 400 for PROC PRINT4500 for PROC MEANSB. 401 for PROC PRINT4501 for PROC MEANSC. 401 for PROC PRINT4500 for PROC MEANSD. 500 for PROC PRINT5000 for PROC MEANSAnswer: BQUESTION 3The following SAS program is submitted:data work.new;length word $7;amount = 7;if amount = 5 then word = 'CAT';else if amount = 7 then word = 'DOG';else work = 'NONE!!!';amount = 5;run;Which one of the following represents the values of the AMOUNT and WORD variables?A. amount word5 DOGB. amount word5 CATC. amount word7 DOGD. amount word7 ' ' (missing character value)Answer: AQUESTION 4Which one of the following is true of the SUM statement in a SAS DATA step program?A. It is only valid in conjunction with a SUM function.B. It is not valid with the SET, MERGE and UPDATE statements.C. It adds the value of an expression to an accumulator variable and ignores missing values.D. It does not retain the accumulator variable value from one iteration of the SAS DATA step to the next.Answer: CQUESTION 5The following SAS program is submitted:data work.sets;do until (prod gt 6);prod + 1;end;run;Which one of the following is the value of the variable PROD in the output data set?A. 5B. 6C. 7D. 8Answer: CQUESTION 6The following SAS program is submitted:proc print data = sasuser.houses;run;<insert OPTIONS statement here>proc means data = sasuser.shoes;run;Which one of the following OPTIONS statements resets the page number to 1 for the second report?A. option pageno = 1;B. option pagenum = 1;C. options reset pageno = 1;D. options reset pagenum = 1;Answer: AQUESTION 7The contents of the raw data file PRODUCT are listed below:----|----10---|----20---|----3024613 $25.31The following SAS program is submitted:data inventory;infile 'product';input idnum 5. @10 price;run;Which one of the following is the value of the PRICE variable?A. 25.31B. $25.31C. . (missing numeric value)D. No value is stored as the program fails to execute due to errors.Answer: CQUESTION 8The contents of the raw data file TYPECOLOR are listed below:----|----10---|----20---|----30daisyyellowThe following SAS program is submitted:data flowers;infile'typecolor';input type $ 1-5 +1 color $;run;Which one of the following represents the values of the variables TYPE and COLOR?A. type colordaisy yellowB. type colordaisy ellowC. type colordaisyyellow (missing character value)D. No values are stored as the program fails to execute due to syntax errors. Answer: BQUESTION 9A raw data record is listed below:----|----10---|----20---|----30son,Travis,The following output is desired:relation firstnameson TravisWhich one of the following SAS programs reads the data correctly?A. data family / dlm = ',';infile 'file-specification';input relation $ firstname $;run;B. option dlm = ',';data family;infile 'file-specification';input relation $ firstname $;run;C. data family;infile 'file-specification' option dlm = ',';input relation $ firstname $;run;D. data family;infile 'file-specification';input relation $ firstname $ / dlm = ',';run;Answer: CQUESTION 10The following SAS program is submitted:libnamerawdata1 'location of SAS data library';filename rawdata2 'location of raw data file';data work.testdata;infile<insert item here>input sales1 salse2;run;Which one of the following is needed to complete the program correctly?A. rawdata1B. rawdata2C. 'rawdata1'D. 'rawdata2'Answer: BQUESTION 11The following SAS program is submitted and reads 100 records from a raw data file:data work.total;infile 'file-specification' end = eof;input name $ salary;totsal+ salary;<insert IF statement here>run;Which one of the following IF statements writes the last observation to the output data set?A. if end = 0;B. if eof = 0;C. if end = 1;D. if eof = 1;Answer: DQUESTION 12The contents of the raw data file FURNITURE are listed below:----|----10---|----20---|----30chair,,tablechair,couch,tableThe following SAS program is submitted:data stock;infile 'furniture' dsd;input item1 $ item2 $ item3 $;run;Which one of the following is the value of the variable named ITEM2 in the first observation of the output data set?A. tableB. ,tableC. . (missing numeric value)D. ' ' (missing character value)Answer: DQUESTION 13A raw data file is listed below:RANCH,1250,2,1,Sheppard Avenue,"$64,000"SPLIT,1190,1,1,Rand Street,"$65,850"CONDO,1400,2,1.5,Market Street,"80,050"TWOSTORY,1810,4,3,Garris Street,"$107,250"RANCH,1500,3,3,Kemble Avenue,"$86,650"SPLIT,1615,4,3,West Drive,"94,450"SPLIT,1305,3,1.5,Graham Avenue,"$73,650"The following SAS program is submitted using the raw data file as input:data work.condo_ranch;infile'file-specification' dsd;input style $ @;if style = 'CONDO' or style = 'RANCH' theninput sqfeet bedrooms baths street $ price : dollar10.;run;How many observations does the WORK.CONDO_RANCH data set contain?A. 0B. 3C. 5D. 7Answer: DQUESTION 14A raw data file is listed below:RANCH,1250,2,1,Sheppard Avenue,"$64,000"SPLIT,1190,1,1,Rand Street,"$65,850"CONDO,1400,2,1.5,Market Street,"80,050"TWOSTORY,1810,4,3,Garris Street,"$107,250"RANCH,1500,3,3,Kemble Avenue,"$86,650"SPLIT,1615,4,3,West Drive,"94,450"SPLIT,1305,3,1.5,Graham Avenue,"$73,650"The following SAS program is submitted using the raw data file as input:data work.condo_ranch;infile'file-specification' dsd;input style $ @;if style = 'CONDO' or style = 'RANCH';input sqfeet bedrooms baths street $ price : dollar10.;run;How many observations will the output data set contain?A. 0B. 3C. 5D. 7Answer: BQUESTION 15The following SAS program is submitted:data numrecords;infile 'file-specification';input @1 patient $15.relative $ 16-26 @;if relative = 'children' theninput @54 diagnosis $15. @;else if relative = 'parents' theninput @28 doctor $15.clinic $ 44-53@54 diagnosis $15. @;input age;run;How many raw data records are read during each iteration of the DATA step during execution?A. 1B. 2C. 3D. 4Answer: AQUESTION 16The following SAS program is submitted:data work.empsalary;set work.people (in = inemp)work.money(in = insal);if insal and inemp;run;The SAS data set WORK.PEOPLE has 5 observations, and the data setWORK.MONEY has 7 observations.How many observations will the data set WORK.EMPSALARY contain?A. 0B. 5C. 7D. 12Answer: AQUESTION 17The contents of two SAS data sets named EMPLOYEE and SALARY are listed below:EMPLOYEE SALARYname age name salaryBruce 30 Bruce 40000Dan 35 Bruce 35000Dan 37000Dan .The following SAS program is submitted:data work.empsalary;merge work.employee (in = inemp)work.salary(in = insal);by name;if inemp and insal;run;How many observations will the data set WORK.EMPSALARY contain?A. 2B. 4C. 5D. 6Answer: BQUESTION 18The SAS data sets WORK.EMPLOYEE and WORK.SALARY are listed below: WORK.EMPLOYEE WORK.SALARYfnameage fname salaryBruce 30 Bruce 25000Dan 40 Bruce 35000Dan 25000The following SAS program is submitted:data work.empdata;merge work.employeework.salary;by fname;totsal+ salary;run;How many variables are output to the WORK.EMPDATA data set?A. 3B. 4C. 5D. No variables are output to the data set as the program fails to execute due to errors. Answer: BQUESTION 19The SAS data sets WORK.EMPLOYEE and WORK.SALARY are shown below: WORK.EMPLOYEE WORK.SALARYfnameage name salaryBruce 30 Bruce 25000Dan 40 Bruce 35000Dan 25000The following SAS program is submitted:data work.empdata;<insert MERGE statement here>by fname;totsal+ salary;run;Which one of the following statements completes the merge of the two data sets by the FNAME variable?A. merge work.employeework.salary (fname = name);B. merge work.employeework.salary (name = fname);C. merge work.employeework.salary (rename = (fname = name));D. merge work.employeework.salary (rename = (name = fname));Answer: DQUESTION 20The following SAS program is submitted:proc sort data=work.employee;by descending fname;proc sort sort data=work.salary;by descending fname;data work.empdata;merge work.employeework.salary;by fname;run;Which one of the following statements explains why the program failed execution?A. The SORT procedures contain invalid syntax.B. The merged data sets are not permanent SAS data sets.C. The data sets were not merged in the order by which they were sorted.D. The RUN statements were omitted after each of the SORT procedures.Answer: CQUESTION 21The following SAS SORT procedure step generates an output data set:proc sort data = sasuser.houses out = report;by style;run;In which library is the output data set stored?A. WORKB. REPORTC. HOUSESD. SASUSERAnswer: AQUESTION 22The following SAS DATA step is submitted:libnametemp 'SAS-data-library';data temp.report;set sasuser.houses;newvar= price * 1.04;run;Which one of the following statements is true regarding the program above?A. The program is reading from a temporary data set and writing to a temporary data set.B. The program is reading from a temporary data set and writing to a permanent data set.C. The program is reading from a permanent data set and writing to a temporary data set.D. The program is reading from a permanent data set and writing to a permanent data set. Answer: DQUESTION 23Which one of the following SAS DATA steps saves the temporary data set named MYDATA as a permanent data set?A. libname sasdata 'SAS-data-library';data sasdata.mydata;copy mydata;run;B. libname sasdata 'SAS-data-library';data sasdata.mydata;keep mydata;run;C. libname sasdata 'SAS-data-library';data sasdata.mydata;save mydata;run;D. libname sasdata 'SAS-data-library';data sasdata.mydata;set mydata;run;Answer: DQUESTION 24The following SAS DATA step is submitted:data sasdata.atlantasasdata.bostonwork.portlandwork.phoenix;set company.prdsales;if region = 'NE' then output bostan;if region = 'SE' then output atlanta;if region = 'SW' then output phoenix;if region = 'NW' then output portland;run;Which one of the following is true regarding the output data sets?A. No library references are required.B. The data sets listed on all the IF statements require a library reference.C. The data sets listed in the last two IF statements require a library reference.D. The data sets listed in the first two IF statements require a library reference. Answer: DQUESTION 25The following SAS DATA step executes on Monday, April 25, 2000:data newstaff;set staff;start_date=today();run;Which one of the following is the value of the variable START_DATE in the output data set?A. a character string with the value '04/25/2000'B. a character string with the value 'Monday, April 25, 2000'C. the numeric value 14725, representing the SAS date for April 25, 2000D. the numeric value 04252000, representing the SAS date for April 25, 2000 Answer: CQUESTION 26The following SAS program is submitted:data work.new;mon= 3;day = 23;year =2000;date = mdy(mon,day,year);run;Which one of the following is the value of the DATE variable?A. a character string with the value '23mar2000'B. a character string with the value '03/23/2000'C. a numeric value of 14692, which represents the SAS date value for March 23, 2000D. a numeric value of 3232000, which represents the SAS date value for March 23, 2000 Answer: CQUESTION 27The following SAS program is submitted:data revenue;set year_1;var1 = mdy(1,15,1960);run;Which one of the following values does the variable named VAR1 contain?A. 14B. 15C. 1151960D. '1/15/1960'Answer: AQUESTION 28The following SAS program is submitted:data work.report;set work.sales_info;if qtr(sales_date) ge 3;run;The SAS data set WORK.SALES_INFO has one observation for each month in the year 2000 and the variable SALES_DATE which contains a SAS date value for each of the twelve months.How many of the original twelve observations in WORK.SALES_INFO are written to the WORK.REPORT data set?A. 2B. 3C. 6D. 9Answer: CQUESTION 29The following SAS program is submitted:?libnametemp 'SAS-data-library';data work.new;set temp.jobs;format newdate mmddyy10.;qdate= qtr(newdate);ddate= weekday(newdate);run;proc print data = work.new;run;The variable NEWDATE contains the SAS date value for April 15, 2000.What output is produced if April 15, 2000 falls on a Saturday?A. Obs newdate qdate ddate1 APR1520002 6B. Obs newdate qdate ddate1 04/15/20002 6C. Obs newdate qdate ddate1 APR1520002 7D. Obs newdate qdate ddate1 04/15/20002 7Answer: DQUESTION 30A raw data record is shown below:07Jan2002Which one of the following informats would read this value and store it as a SAS date value?A. date9.B. ddmonyy9.C. ddMMMyy9.D. ddmmmyyyy9.Answer: AQUESTION 31The contents of the SAS data set PERM.JAN_SALES are listed below: VARIABLE NAME TYPEidnumcharacter variablesales_datenumeric date valueA comma delimited raw data file needs to be created from the PERM.JAN_SALES data set. The SALES_DATE values need to be in a MMDDYY10 form.Which one of the following SAS DATA steps correctly creates this raw data file?A. libname perm 'SAS-data-library';data_null_;set perm.jan_sales;file 'file-specification' dsd = ',';put idnum sales_date : mmddyy 10.;run;B. libname perm 'SAS-data-library';data_null_;set perm.jan_sales;file 'file-specification' dlm = ',';put idnum sales_date : mmddyy 10.;run;C. libname perm 'SAS-data-library';data_null_;set perm.jan_sales;file 'file-specification';put idnum sales_date : mmddyy 10. dlm = ',';run;D. libname perm 'SAS-data-library';data_null_;set perm.jan_sales;file 'file-specification';put idnum sales_date : mmddyy 10. dsd = ',';run;Answer: BQUESTION 32The contents of the SAS data set named PERM.STUDENTS are listed below:Alfred 14Alice13Barbara 13Carol 14The following SAS program is submitted using the PERM.STUDENTS data set as input:Libnameperm 'SAS-date-library';data students;set perm.students;file 'file-specification';put name $15. @5 age 2.;runWhich one of the following represents the values written to the output raw data file?A. ----|----10---|----20---|----30Alfred 14Alice 13Barbara 13Carol 14B. ----|----10---|----20---|----30Alfr14Alic13Barb13aCaro14C. ----|----10---|----20---|----30Alfr14edAlic13eBarb13araCaro14lD. ----|----10---|----20---|----30Alfred 14Alice 13Barbara 13Carol 14Answer: BQUESTION 33The contents of the raw data file TEAM are listed below:----|----10---|----20---|----30Janice 10Henri 11Michael 11Susan 12The following SAS program is submitted:infile 'team';input name $15. age 2.;file 'file-specification';put name $15. =5 age 2.;run;Which one of the following describes the output created?A. a raw data file onlyB. a SAS data set named GROUP onlyC. a SAS data set named GROUP and a raw data fileD. No output is generated as the program fails to execute due to errors.Answer: CQUESTION 34The following SAS program is submitted:data_null_;set old;put sales1 sales2;run;Where is the output written?A. the SAS logB. the raw data file that was opened lastC. the SAS output window or an output fileD. the data set mentioned in the DATA statementAnswer: AQUESTION 35The following SAS program is submitted:data_null_;set old (keep = prod sales1 sales2);file 'file-specification';put sales1 sales2;run;Which one of the following default delimiters separates the fields in the raw data file created?A. : (colon)B. (space)C. , (comma)D. ;(semicolon)Answer: BQUESTION 36The following SAS program is submitted:data allobs;set sasdata.origin (firstobs = 75 obs = 499);run;The SAS data set SASDATA.ORIGIN contains 1000 observations.How many observations does the ALLOBS data set contain?A. 424B. 425C. 499D. 1000Answer: BQUESTION 37The SAS data set named COMPANY.PRICES is listed below: COMPANY.PRICESprodidprice producttype sales returnsK12S 5.10 NETWORK 15 2B132S 2.34 HARDWARE 300 10R18KY2 1.29 SOFTWARE 25 53KL8BY 6.37 HARDWARE 125 15DY65DW 5.60 HARDWARE 45 5DGTY23 4.55 HARDWARE 67 2The following SAS program is submitted:libnamecompany 'SAS-data-library';data hware inter soft;set company.prices (keep = producttype price);if price le 5.00;if producttype = 'HARDWARE' then output HWARE;else if producttype = 'NETWORK' then output INTER;else if producttype = 'SOFTWARE' then output SOFT;run;How many observations does the HWARE data set contain?A. 0B. 2C. 4D. 6Answer: BQUESTION 38The SASDATA.BANKS data set has five observations when the following SASprogram is submitted:libnamesasdata 'SAS-date-library';data allobs;set sasdata.banks;capital=0;do year = 2000 to 2020 by 5;capital + ((capital+2000) * rate);output;end;How many observations will the ALLOBS data set contain?A. 5B. 15C. 20D. 25Answer: DQUESTION 39A raw data file is listed below:----|----10---|----20---|----30John McCloskey 35 71June Rosesette 10 43TinekeJones 9 37The following SAS program is submitted using the raw data file as input: data work.homework;infile 'file-specification';input name $ age height;if age LE 10;run;How many observations will the WORK.HOMEWORK data set contain?A. 0B. 2C. 3D. No data set is created as the program fails to execute due to errors. Answer: CQUESTION 40The following SAS program is submitted:proc contents data = sasuser.airplanes;run;Which one of the following is produced as output?A. the data portion of every data set in the SASUSER libraryB. the data portion of the data set SASUSER.AIRPLANES onlyC. the descriptor portion of every data set in the SASUSER libraryD. the descriptor portion of the data set SASUSER.AIRPLANES onlyAnswer: DQUESTION 41The following SAS program is submitted:proc datasets lib = sasuser;contents data = class varnum;quit;Which one of the following is the purpose of the VARNUM option?A. to print a list of variable namesB. to print the total number of variablesC. to print a list of the variables in alphabetic orderD. to print a list of the variables in the order they were createdAnswer: DQUESTION 42Which one of the following SAS procedures displays the data portion of a SAS data set?A. PRINTB. FSLISTC. CONTENTSD. DATASETSAnswer: AQUESTION 43On which portion(s) of a SAS data set does the PRINT procedure report?A. the data portion onlyB. the descriptor portion onlyC. the descriptor portion and the data portionD. neither the data portion nor the descriptor portionAnswer: AQUESTION 44The following SAS program is submitted:data work.test;set work.staff (keep = jansales febsales marsales);array diff_sales{3} difsales1 - difsales3;array monthly{3} jansales febsales marsales;run;Which one of the following represents the new variables that are created?A. JANSALES, FEBSALES and MARSALESB. MONTHLY1, MONTHLY2 and MONTHLY3C. DIFSALES1, DIFSALES2 and DIFSALES3D. DIFF_SALES1, DIFF_SALES2 and DIFF_SALES3Answer: CQUESTION 45The following SAS program is submitted:data work.test;array agent{4} $ 12 sales1 - sales4;run;Which one of the following represents the variables that are contained in the outputdata set?A. SALES1, SALES2, SALES3, SALES4B. AGENTS1, AGENTS2, AGENTS3, AGENTS4C. None, the DATA step fails because the ARRAY statement can reference only numeric data.D. None, the DATA step fails because the ARRAY statement can reference onlypre-existing variables.Answer: AQUESTION 46The following SAS program is submitted:data stats;set revenue;array weekly{5} mon tue wed thus fri;<insert DO statement here>total = weekly{i} * .25;Which one of the following DO statements completes the program and processes the elements of the WEEKLY array?A. do i = 1 to 5;B. do weekly {i} = 1 to 5;C. do i = mon tue wed thu fri;D. A DO loop cannot be used because the variables referenced do not end in a digit. Answer: AQUESTION 47Which one of the following statements is true regarding the name of a SAS array?A. It is saved with the data set.B. It can be used in procedures.C. It exists only for the duration of the DATA step.D. It can be the same as the name of a variable in the data set.Answer: CQUESTION 48The observations in the SAS data set WORK.TEST are ordered by the values of the variable SALARY.The following SAS program is submitted:proc sort data = work.test out = work.testsorted;by name;run;Which one of the following is the result of the SAS program?A. The data set WORK.TEST is stored in ascending order by values of the NAME variable.B. The data set WORK.TEST is stored in descending order by values of the NAME variable.C. The data set WORK.TESTSORTED is stored in ascending order by values of the NAME variable.D. The data set WORK.TESTSORTED is stored in descending order by values of the NAME variable.Answer: CQUESTION 49The SAS data set WORK.AWARDS is listed below:fnamepointsAmy 2Amy 1Gerard 3Wang 3Wang 1Wang 2The following SAS program is submitted:proc sort data = work.awards;by descending fname points;run;Which one of the following represents how the observations are sorted?A. Wang 3Gerard 3Wang 2Amy 2Wang 1Amy 1B. Wang 3Wang 2Wang 1Gerard 3Amy 2Amy 1C. Wang 3Wang 1Wang 2Gerard 3Amy 2Amy 1D. Wang 1Wang 2Wang 3Gerard 3Amy 1Amy 2Answer: DQUESTION 50The SAS data set EMPLOYEE_INFO is listed below:IDNumberExpenses2542 100.003612 133.152198 234.342198 111.12The following SAS program is submitted:proc sort data = employee_info;<insert BY statement here>run;Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within each ascending IDNUMBER value?A. by Expenses IDNumber;B. by IDNumber Expenses;C. by ascending (IDNumber Expenses);D. by ascending IDNumber ascending Expenses;Answer: BQUESTION 51The following SAS program is submitted:libnamecompany 'SAS-data-library';proc sort data = company.payroll;by EmployeeIDNumber;run;Write access has been granted to the COMPANY library.Which one of the following represents how the observations are sorted?A. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber.B. COMPANY.PAYROLL is stored in original order, and a new data set PAYROLL is created in sorted order by EmployeeIDNumber.C. COMPANY.PAYROLL is stored in original order, and a new data set COMPANY.PAYROLLSORTED is created in sorted order by EmployeeIDNumber.D. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber, and a new data set PAYROLL is created in sorted order by EmployeeIDNumber. Answer: AQUESTION 52The SAS data set QTR1_REVENUE is listed below:destination revenueYYZ 53634FRA 62129FRA 75962RDU 76254YYZ 82174The following SAS program is submitted:proc sort data = qtr1_revenue;by destination descending revenue;run;Which one of the following represents the first observation in the output data set?A. destination revenueYYZ 82174B. destination revenueYYZ 53634C. destination revenueFRA 62129D. destination revenueFRA 75962Answer: DThe SAS data set EMPLOYEE_INFO is listed below:IDNumberExpenses2542 100.003612 133.152198 234.342198 111.12The following SAS program is submitted:proc sort data = employee_info;<insert BY statement here>run;Which one of the following BY statements completes the program and sorts the data sequentially by descending expense values within each descending IDNUMBER value?A. by descending IDNumber Expenses;B. by (IDNumber Expenses) descending;C. by IDNumber descending Expenses descending;D. by descending IDNumber descending Expenses;Answer: DQUESTION 54The following SAS program is submitted:data work.new;length word $7;amount = 4;if amount = 4 then word = 'FOUR';else if amount = 7 then word = 'SEVEN';else word = 'NONE!!!';amount = 7;run;Which one of the following represents the values of the AMOUNT and WORD variables?A. amount word7 FOURB. amount word7 SEVENC. amount word4 FOURD. amount word4 ' ' (missing character value)Answer: A。

SAS期末考试题_2014

SAS期末考试题_2014

SAS期末考试题(从中至少选择6题)一。

SAS的逻辑库可分为永久库和临时库两种,请编写一段程序直接建立临时库(work)中的下例数据集,按升序排序,并进行正态性检验.数据名test:55 20 13 20 16 23 19 35 19 16 98二.用乙基柯柯碱做利尿试验,实验分两组,一组注射乙基柯柯碱10mg/kg,一组注射生理盐水做对照,以给药后90Min排尿量(ml)作为药物作用指标,对照组与用药组的观察值列出如下:对照组:86。

3 45。

0 82。

5 56.0 88。

0 26.5用药组:86.0 143。

0 111。

5 171.0 100.0•1。

对资料进行正态性检验• 2.选择合适的指标对资料进行统计学描述•3。

试比较两种药物的疗效是否有差别三. 1.请编写一段程序把数据2并列合并到数据1之后2.对合并后的数据进行更新,更新后的数据替换原来的数据,需要更新的数据包括:ZhouLan的性别由F改为M;WeiLin的年龄20改为25.3。

对合并后的数据集进行转置数据1:LiuWei M 21 175 65 AZhouLan F 20 160 46 ODengXue F 22 158 45 BZhuJun M 23 177 68 OHuangXiaoming M 19 173 65 O数据2:ChenQiong F 19 155 45 AZhaoFeng M 22 179 66 BZhangBin M 22 173 64 OWeiLin F 20 162 46 AShiQiang M 21 180 70 B四、某职业病防治院对31名石棉矿工中的石棉肺患者、可疑患者及非患者进行了用力肺活量测定,问三组石棉矿工的用力肺活量有无差别?(方差分析proc五、为了考察化肥施用量与水稻产量之间的关系,在土质、面积、种子等相同条件下,由试验取得了如下的数据:化肥用量X (kg) 15 20 25 30 35 40 45水稻产量Y (kg)330 345 365 405 445 490 455• 1. 作出散点图,并分析x与y之间的关系• 2. 生成一个新变量sum(sum=X+Y),并对sum变量进行描述统计分析六、药物A、B分别试500例,用A药发生呕吐反应有6例,用B药发生呕吐反应有11例,问A、B两人药发生呕吐反应率有无差别?(列联表分析)•1。

sas试题答案

sas试题答案
sas试题答案三基考试试题及答案党章考试试题及答案普法考试试题及答案中考数学试题及答案党校考试试题及答案基础会计试题及答案护理三基试题及答案社区护理试题及答案时事政治试题及答案
李曰进5112410038姚明国5112410047
1、
1956年某地几种传染病的病死率
2
某市某年男女学生各年龄组的平均身高(cm)
t4=1-probnorm(z2);
a=probit(0.995);
b=probit(0.975);
M=m+a*s;
N=m-a*s;
O=m+b*s;
Q=m-b*s;
z=probit(0.9);
L=m-z*s; U=m+z*s;
procprint;
vart3 t4 zLU M N O Q;
run;
结果:The SAS System 14:12 Wednesday, October 13, 2014 13
结果:
The SAS System 14:12 Wednesday, October 13, 2014 2
Obs p1 p2 p3
1 0.37035 0.66045 0.68093
5、dataex4_3;
p1=poisson(3,2)-poisson(3,1);
p2=poisson(3,1);
procprint;
3、dataex4_1;
p1=probbnml(0.3,10,0);
p2=probbnml(0.3,10,5)-probbnml(0.3,10,4);procpri源自t;run;结果:
The SAS System
14:12 Wednesday, October 13, 2014 1

实用医学统计学与SAS应用_苏州大学中国大学mooc课后章节答案期末考试题库2023年

实用医学统计学与SAS应用_苏州大学中国大学mooc课后章节答案期末考试题库2023年

实用医学统计学与SAS应用_苏州大学中国大学mooc课后章节答案期末考试题库2023年1.下面关系SAS编程那句话是错的()参考答案:SAS编程只能一行一句2.均数的标准误反映了()参考答案:样本均数的离散程度3.下述属于离散趋势的描述性指标的是()参考答案:四分位数间距4.假设检验中,P值越小,则()参考答案:越有理由认为两总体参数不同5.线性回归系数的取值参考答案:可以是正数也可以是负数6.统计资料可以分为()参考答案:数值变量资料和分类变量资料7.统计学所说的总体是()参考答案:根据研究目的确定的同质研究对象全体8.统计工作的基本步骤分为()参考答案:统计设计、搜集资料、整理资料、分析资料9.SAS显示管理系统包括()参考答案:前三者都包括10.单样本均数t检验的应用前提是()。

参考答案:样本来自正态分布的总体11.有关SAS永久性数据集的描述是错的()参考答案:SAS永久性数据集放在work的子目录中12.下述有关样本方差的解释,不正确的是()参考答案:样本含量越大,所计算出的样本方差越大13.直线回归方程的假设检验可以用参考答案:方差分析14.下列哪项不是规范统计表所有的结构()。

参考答案:竖线15.正态分布的两个参数为m与s,()对应的正态分布曲线越陡峭。

参考答案:s越小16.正态分布曲线下,横轴上【图片】范围内的面积为()。

参考答案:97%17.关于医学参考值范围,下列说法正确的是()。

参考答案:医学参考值范围是指绝大多数“正常人”的生理、生化等指标的波动范围18.下列不是实验基本原则的是()参考答案:依从性19.下列不是实验研究特征的是()参考答案:可以按暴露情况自然分组20.对于t分布来说,固定显著性水平的值,随着自由度的增大,临界值将会( ) 。

参考答案:减小21.完全随机设计两独立小样本计量资料比较的假设检验,首先应考虑()。

参考答案:资料符合t检验还是Wilcoxon秩和检验条件22.完全随机设计方差分析的实例中有()。

sas期末试题及答案解析

sas期末试题及答案解析

sas期末试题及答案解析一、选择题1. 下列哪个选项是正确的?a) SAS是一种统计分析软件b) SAS是一种操作系统c) SAS是一种数据库管理系统d) SAS是一种编程语言答案:a) SAS是一种统计分析软件解析:SAS(Statistical Analysis System,统计分析系统)是一套用于数据管理、报表制作、统计分析、数据挖掘等功能的软件系统。

它由美国SAS公司开发,广泛应用于各个领域的数据处理和决策支持。

2. SAS的基本语法是什么?a) Javab) C++c) Pythond) SAS答案:d) SAS解析:SAS软件具有自己的编程语言,即SAS语言。

它是一种类似于SQL的专用于数据处理和分析的语言,具有丰富的数据操作和统计分析函数。

3. 在SAS中,用于读取外部数据文件的语句是什么?a) INPUTb) OUTPUTc) EXPORTd) IMPORT答案:d) IMPORT解析:在SAS中,使用IMPORT语句可以将外部数据文件导入到SAS数据集中,方便后续的数据处理和分析。

4. 下列哪个函数可以用于计算某一列数据的平均值?a) SUMb) COUNTc) MINd) MEAN答案:d) MEAN解析:MEAN函数可以用于计算某一列数据的平均值,它是统计分析中常用的函数之一。

二、填空题1. SAS中用于创建新变量的语句是_______。

答案:DATA解析:在SAS中,使用DATA语句可以创建一个新的数据集,并进行后续的数据处理和分析。

2. SAS中用于选择某些特定观测值的语句是________。

答案:WHERE解析:WHERE语句可以用于筛选出符合特定条件的观测值,方便进行针对性的分析和处理。

三、问答题1. 请简要介绍一下SAS的应用领域。

答:SAS的应用领域非常广泛,包括但不限于以下几个方面:1) 统计分析:SAS是一套强大的统计分析软件,可以对大量的数据进行统计描述、推断分析、回归分析、时间序列分析等,为用户提供科学而有效的分析结果。

sas练习题

sas练习题

SAS练习题一、基础操作类1. 如何在SAS中创建一个数据集?2. 请写出SAS中读取外部数据文件的语句。

3. 如何在SAS中查看数据集的结构?4. 如何在SAS中对数据集进行排序?5. 请写出SAS中合并两个数据集的语句。

6. 如何在SAS中删除一个数据集?7. 请简述SAS中变量的命名规则。

8. 如何在SAS中修改数据集的属性?9. 请写出SAS中创建临时数据集和永久数据集的语句。

10. 如何在SAS中导入和导出Excel文件?二、数据处理类1. 如何在SAS中对缺失值进行处理?2. 请写出SAS中计算变量总和、平均数、最大值和最小值的语句。

3. 如何在SAS中进行条件筛选?4. 请简述SAS中日期和时间的处理方法。

5. 如何在SAS中实现数据的分组汇总?6. 请写出SAS中创建新变量的语句。

7. 如何在SAS中进行数据类型转换?8. 请写出SAS中替换变量值的语句。

9. 如何在SAS中实现数据的横向连接和纵向连接?10. 请简述SAS中数组的使用方法。

三、统计分析类1. 如何在SAS中进行单因素方差分析?2. 请写出SAS中进行t检验的语句。

3. 如何在SAS中计算相关系数?4. 请简述SAS中回归分析的基本步骤。

5. 如何在SAS中进行主成分分析?6. 请写出SAS中进行聚类分析的语句。

7. 如何在SAS中实现时间序列分析?8. 请简述SAS中生存分析的基本概念。

9. 如何在SAS中进行非参数检验?10. 请简述SAS中多重响应分析的方法。

四、图形绘制类1. 如何在SAS中绘制直方图?2. 请写出SAS中绘制散点图的语句。

3. 如何在SAS中绘制饼图?4. 请简述SAS中绘制箱线图的方法。

5. 如何在SAS中绘制条形图?6. 请写出SAS中绘制折线图的语句。

7. 如何在SAS中设置图表的颜色和样式?8. 请简述SAS中绘制雷达图的方法。

9. 如何在SAS中实现图表的交互功能?10. 请简述SAS中图表导出的方法。

SAS练习题及答案

SAS练习题及答案

1.SAS系统主要完成以数据为中心的四大功能,其中核心功能为:统计分析功能2.在SAS系统的组成模块中,能进行数据管理和数据加工、处理的模块……BASE模块3.SAS显示管理系统窗口中能够提交当前运行的SAS程序执行过程的窗口为:…………………………………………………………………PGM窗口4.如下一段SAS程序:DATA ;INPUT X @@;CARDS:2 3 4 9 1 ;RUN;模块当运行程序以后SAS系统会产生SAS数据集………………………………………( C )A. DATAB. NULLC. DATA1D.程序错误5.INPUT语句一般用来指定数据的读入方式,可以读取各种类型的数据包括字符型,现有如下的一段程序:DATA ONE;INPUT NAME $ SCORE;CARDS;Wanglin 85Zhang dong-feng 90;那么在第二个观测中读取到的NAME 为……………………………………………(B)A. Zhang dong-fengB. ZhangC. Zhang doD. Zhang dong6.假设变量X的值为5,有如下程序IF X<5 THENX=X+3;ELSEX=X-2;则执行程序以后变量X的值为………………………………………………………( B)A. 5B.3C.8D. 程序错误7.DATA TEST;DO I=1 TO 3;PUT I= ;END;RUN;程序结果在LOG窗口输出形式为……………………………………………………( A )A. I=1 I=2 I=3B.I=2 I=3 I=4C. 不显示D. I=3 I=2 I=18.假设变量X1=-10.253 X2=-5 则[SIGN(X1)+ABS(X2)]/INT(X1)的运算结果为………………………………………( B)A.-4B.-0.4C. 4D.0.5759.逻辑运算[(5<1)|(4<>2)]&(7>2)的结果为:……………………………………( 1 )10.以下几个统计量在UNIVARIATE过程中能求得到得而在MEANS过程中无法求得的是………………………………………………………………………………………( B )A. meanB. varC. Q1D.range11.SAS系统主要完成以数据为中心的四大功能,其中能够将Excel、Lotus、DBF、TXT等数据转化成SAS 数据集属于…………………………… (数据管理功能 )12. SAS数据集是关系型结构,分成两部分:描述部分和。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

SAS统计软件试题2008
一、SAS的逻辑库可分为永久库和临时库两种,请编写一段程序直接建立临时库中的下例
数据集,并按升序排序。

(10分)
数据名tong:20 13 20 16 23 19 19 16
答:data tong;
input x@@;
cards;
20 13 20 16 23 19 19 16
;
proc sort;
by descending x;
run;
二、请编写一段程序把数据2并列合并到数据1之后。

(20分)
数据1:
LiuWei M 21 175 65 A
ZhouLan F 20 160 46 O
DengXue F 22 158 45 B
ZhuJun M 23 177 68 O
HuangXiaoming M 19 173 65 O
数据2:
ChenQiong F 19 155 45 A
ZhaoFeng M 22 179 66 B
ZhangBin M 22 173 64 O
WeiLin F 20 162 46 A
ShiQiang M 21 180 70 B
答:data shuju1;
input name $ sex $ age hight weight type $;
cards;
LiuWei M 21 175 65 A
ZhouLan F 20 160 46 O
DengXue F 22 158 45 B
ZhuJun M 23 177 68 O
HuangXiaoming M 19 173 65 O
;
data shuju2;
input name $ sex $ age hight weight type $;
cards;
ChenQiong F 19 155 45 A
ZhaoFeng M 22 179 66 B
ZhangBin M 22 173 64 O
WeiLin F 20 162 46 A
ShiQiang M 21 180 70 B
;
data shuju;
set shuju1 shuju2; /*set表示纵向合并*/
run;
三、 1. 数据1( suju1.txt)和数据2( suju2.txt)为存放在E:\myfile中的两个文本文件,请编写一段程序读入外部数据,建立成SAS的临时库中的两个数据集。

(10分)
答:data suju1;
infile 'e:\myfile\suju1.txt';
input number doornum cardnum;
data suju2;
infile 'e:\myfile\suju2.txt';
input name$ sex$ age;
run;
2. 把数据1合并到数据2的尾部。

(10分)
数据1:suju1.txt
115031 201 2655020
105002 304 5641405
115005 313 2577845
115020 105 5650011
105011 413 5643257
数据2:suju2.txt
YangLan F 21
XuZhangxiang M 22
WangYu M 20
HouLin F 19
LiangTian M 21
答:data suju;
merge suju2 suju1;
run;
四、(20分) 对六种不同的农药在相同的条件下分别进行杀虫试验,试验结果如下表所示。

试检验农药(因素A)的品种对杀虫率是否有显著影响。

用SAS分析如下,请将空白处补充完整。

The ANOVA Procedure
Dependent Variable: a
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 5 3794.5 758.9 51.16 <.0001
Error 12 178 14.83333
Corrected Total 17 3972.5
The ANOVA Procedure
Levene's Test for Homogeneity of a Variance ANOVA of Squared Deviations from Group Means
Sum of Mean
Source DF Squares Square F Value Pr > F b 3 83.9182 27.9727 0.32 0.8083 Error 10 864.0 86.4042
由第2个表,我们得出的结果是:
由第1水准上,拒绝0H ,接受1H ,认为农药种类对杀虫效果影响显著。

五、(20分) 为了考察化肥施用量
x 与水稻产量y
之间的关系,在土质、面
积、种子等相同条件下,由试验取得了如下的数据:
化肥用量x (kg) 15 20 25 30 35 40 45
水稻产量y
(kg) 330 345 365 405 445 490 455
1. 作出散点图,并分析x 与y 之间的关系。

用SAS 分析的结果如下,请将空白处补充完整。

Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 Error 5 2327.67857 465.53571 Corrected Total 6 22150
Root MSE 21.57628 R-Square 0.8949 Dependent Mean 405.00000 Adj R-Sq 0.8739 Coeff Var 5.32748
Parameter Estimates
Parameter Standard Standardized
Variable DF Estimate Error t Value Pr > |t| Estimate
Analysis of Variance 表说明了: 直线回归模型线性显著。

Parameter Estimates
2.问:比较若分别建立直线、二次抛物线、立方抛物线方程,哪一个拟合的最好?
答:简单回归分析的3种模型的比较如下表:
通过上表可以看出,在 =0.05的水准上,都有显著意义。

立方抛物线方程的均方根最小,相关指数最大,表明立方抛物线方程拟合得最好。

相关文档
最新文档