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软件的使用方法和语言结构➢学会运用sas软件进行简单的数据处理实验内容1某小学60名11岁学生的身高(单位cm)的数据如下126 149 143 141 127 123 137 132 135 134 146 142 135 141 150 137 144 137 134 139 148 144 142 137 147 138 140 132 149 131 139 142 138 145 147 137 135 142 151 146 129 120 143 145 142 136 147 128 142 132 138 139 147 128 139 146 139 131 138 149 (1)计算均值、方差、标准差、变异系数、偏度、峰度;(2)计算中位数,上、下四分位数,四分位极差,三均值;(3)做出直方图;(4)做出茎叶图;解答1)使用sas软件编程答案为:统计量身高N 有效60缺失0均值139.0000中值139.0000标准差7.06387方差49.898偏度-.510偏度的标准误.309峰度-.126峰度的标准误.608百分位数25 135.000050 139.000075 144.7500变异系数=标准差/均值=5.08%2)部分结果在问题(1)中中位数:139.0000四分位极差=Q3-Q1=144.75-135=9.75三均值=0.25*Q1+0.5*M+0.25*Q3=139.4375 3)使用软件画图得到4)使用sas软件画图得到程序附录(1)DATA DQGZ;INPUT X @@;CARDS;126 149 143 141 127 123 137 132 135 134 146 142 135 141 150 137 144 137 134 139 148 144 142 137 147 138 140 132 149 131 139 142 138 145 147 137 135 142 151 146 129 120 143 145 142 136 147 128 142 132 138 139 147 128 139 146 139 131 138 149 PROC MEANS N MEAN STD VAR USS CSS;RUN;(4)身高 Stem-and-Leaf PlotFrequency Stem & Leaf1.00 Extremes (=<120)1.00 12 . 35.00 12 . 678897.00 13 . 112224418.00 13 . 555677777888899999 13.00 14 . 011222222334413.00 14 . 55666777789992.00 15 . 01Stem width: 10.00Each leaf: 1 case(s)。

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.随机取组随机取组 有无重复试验的两种有无重复试验的两种 本题是无重复本题是无重复 DATA PGM15G; DO A=1 TO 4; /*A 为窝别*/ DO B=1 TO 3; ; /*B /*B 为雌激素剂量*/ INPUT X @@; X @@; /*X /*X 为子宫重量*/OUTPUT ;END ;END ;CARDS ;106 116 145 42 68 115 70 111 133 42 63 87 ; RUN ;ods html ; /*将结果输出成网页格式,SAS9.0以后版本可用*/ PROC GLM DATA =PGM15G; CLASS A B;MODEL X=A B / X=A B / SS3SS3;MEANS A B; /*给出因素A 、B 各水平下的均值和标准差*/MEANS B / B / SNK SNK ; /*对因素B (即剂量)各水平下的均值进行两两比较*/ RUN ;ODS HTML CLOSE ;2. 2*3析因设计析因设计 两因素两因素 完全随机完全随机 统计方法统计方法 2*3析因设计析因设计 tiff =f 的开方的开方DATA aaa; DO zs=125,200;DO repeat=1 TO 2; ; /*/*每种试验条件下有2次独立重复试验*/ do js=0.015,0.030,0.045; INPUT cl @@; OUTPUT ;END ;END ;END ; CARDS ;2.70 2.45 2.60 2.78 2.49 2.72 2.83 2.85 2.86 2.86 2.80 2.87 ; run ;PROC GLM ;CLASS zs js; MODEL cl=zs js zs*js / cl=zs js zs*js / SS3SS3; MEANS zs*js;LSMEANS zs*js / TDIFF PDIFF ; ; /*/*对 zs 和js 各水平组合而成的试验条件进行均数进行两两比较*/ RUN ;ODS HTML CLOSE ;练习一:2*2横断面研究列链表横断面研究列链表 方法:卡方方法:卡方 矫正卡方矫正卡方 FISHERDATA PGM19A;DO A=1 TO 2; DO B=1 TO 2;INPUT F @@;OUTPUT ;END ;END ;CARDS ; 2 26 8 21 ;run ;PROC FREQ ; WEIGHT F;TABLES A*B / A*B / CHISQ CHISQ ;RUN ;样本大小 = 57练习二:对裂列连表练习二:对裂列连表 结果变量结果变量 换和不换换和不换 三部曲三部曲 1横断面研究横断面研究 P 《0.05 RDATA PGM19B; DO A=1 TO 2; DO B=1 TO 2;INPUT F @@;OUTPUT ;END ;END ;CARDS ; 40 3414 1 19252 ; run ; ods html ;PROC FREQ ; WEIGHT F;TABLES A*B / A*B / CHISQCHISQ cmh ; RUN ;ods html close ;样本大小 = 57练习三:病例对照2*2 病例组中病例组中 有何没有那个基因有何没有那个基因 是正常的3.8倍,倍, 则有可能导致痴呆则有可能导致痴呆 要做前瞻性研究要做前瞻性研究 用对裂用对裂DATA PGM20;DO A=1 TO 2; DO B=1 TO 2;INPUT F @@;OUTPUT ;END ;END ;CARDS ; 240 60 360 340 ;run ; ods html ; PROC FREQ ; WEIGHT F;TABLES A*B / A*B / CHISQ CHISQcmh ; RUN ; ods html close ;总样本大小 = 1000 练习四:配对设计配对设计 隐含金标准2*2 MC 卡方卡方 检验检验 34和0在总体上在总体上((B+C 《40 用矫正卡方) 是否相等是否相等 则可得甲培养基优于乙培养基则可得甲培养基优于乙培养基 一般都用矫正一般都用矫正 因卡方为近似计算因卡方为近似计算DATA PGM19F; INPUT b c;chi=(ABS(b-c)-1)**2/(b+c);p=1-PROBCHI(chi,1);求概率 1减掉从左侧积分到卡方的值减掉从左侧积分到卡方的值 chi=ROUND(chi, 0.001);IF p>0.0001 THEN p=ROUND(p,0.0001);FILEPRINT ; PUT (打印在输出床口) #2 @10'Chisq' @30 'P value'(#表示行) #4 @10 chi @30 p; CARDS ; 34 0 ;run;ods html close;练习五:双向有序R*C列连表列连表用KPA data aaa;do a=1 to 3;do b=1 to 3;input f @@;output;end;end;cards ;58 2 31 42 78 9 17;run;ods html;*简单kappa检验;proc freq data=aaa;weight f;(频数)(频数)tables a*b;test kappa;run ;*加权kappa检验;proc freq;weight f;tables a*b;test wtkap;run ;ods html close;SAS 系统FREQ 过程频数 百分比 行百分比列百分比a *b 表a b 合计1 2 31 5839.4621.3632.046342.8692.06 86.57 3.173.774.7611.112 10.682.001.49 4228.5784.0079.2574.7614.0025.935034.013 85.4423.5311.94 96.1226.4716.981711.5650.0062.963423.13合计 6745.58 5336.052718.37147100.00a *b 表的统计量对称性检验统计量 (S) 2.8561自由度 3Pr > S 0.4144对称性检验指 总体上主对角线的上三角数相加是否与下三角三个数相加 对称性检验与KPA 检验是否一致 是否一个可以代替另一个检验 Pe理论观察一致率 独立假设性基础上计算的 相互独立简单 Kappa 系数Kappa 0.6809渐近标准误差 0.050095% 置信下限 0.583095% 置信上限 0.7788H0 检验: Kappa = 0总体的H0 下的渐近标准误差 0.0597Z 11.4112H0 检验: Kappa = 0单侧 Pr> Z <.0001双侧 Pr>|Z| <.0001总体的KPA是否为0 KPA大于0两种方法的一致性有统计学意义 小于0 不一致性有统计学意义加权的 Kappa 系数加权的 Kappa 0.6614渐近标准误差 0.056095% 置信下限 0.551695% 置信上限 0.7711置信区间不包括0 拒绝H0 按此计算结果可以用一种取代另一种方法 但要看专业要求达到多少才可以 观测一致率达到多少才可以代替样本大小 = 147FREQ 过程频数 百分比 行百分比列百分比a *b 表a b 合计1 2 31 5839.4692.0686.5721.363.173.7732.044.7611.116342.862 10.682.001.494228.5784.0079.2574.7614.0025.935034.013 85.4423.5311.9496.1226.4716.981711.5650.0062.963423.13合计 6745.58 5336.052718.37147100.00a *b 表的统计量对称性检验统计量 (S) 2.8561自由度 3Pr > S 0.4144简单 Kappa 系数Kappa 0.6809渐近标准误差 0.050095% 置信下限 0.583095% 置信上限 0.7788加权的 Kappa 系数加权的 Kappa 0.6614渐近标准误差 0.056095% 置信下限 0.551695% 置信上限 0.7711H0 检验: 加权的 Kappa = 0H0 下的渐近标准误差 0.0646Z 10.2406单侧 Pr> Z <.0001双侧 Pr>|Z| <.0001对加权的KPA 检验 与简单的(利用对角线上的数据分析)加权还要利用对角线以外的数据分析 样本大小 = 147练习六:双向无序R*C 列连表列连表 用卡方理论频数小于5没有超过五分之一,没有超过五分之一,一般用卡方一般用卡方一般用卡方 实在不行用FISHER 检验检验 超过用KPA 两种血型都是按小中大排列两种血型都是按小中大排列 相互不影响相互不影响 独立的独立的 接受H0 不一致不一致行与列变量相互不影响行与列变量相互不影响 DATA PGM20A; DO A=1 TO 4; DO B=1 TO 3;INPUT F @@;OUTPUT ;END ;END ;CARDS ;431 490 902 388 410 800 495 587 950 137 179 325 ; run ; ods html ; PROC FREQ ; WEIGHT F;TABLES A*B / A*B / CHISQCHISQ ;*exact; RUN ;ods html close ;样本大小 = 6094练习七:单向有序R*C 秩和检验秩和检验*方法1;(单因素非参数 HO 三个药物疗效相同 H1不完全相等)不完全相等) DATA PGM20C; DO A=1 TO 4; DO B=1 TO 3; INPUT F @@;OUTPUT ;END ;END ;CARDS ; 15 4 1 49 9 15 31 50 45 5 22 24 ; run ; ods html ;PROC NPAR1WAY WILCOXON ; FREQ FREQ F;CLASS B; VAR A; RUN ;*方法2;(FIQ CHIM ) proc freq data =PGM20C; weight f;tables b*a/ b*a/cmh cmhscores =rank; run ; ods html close ;总样本大小 = 270练习八:练习八: 双向有序双向有序 属性不同属性不同 R*C 4种目的4种方法种方法SPEARMAN 秩相关分析 DATA PGM20E; DO A=1 TO 3; DO B=1 TO 3;INPUT F @@;OUTPUT ;END ;END ;CARDS ; 215 131 148 67 101 128 44 63 132;run ; ods html ; PROC CORR SPEARMAN ;VAR A B; FREQ F; RUN ;ods html close ;统计分析与SAS 实现第1次上机实习题一、定量资料上机实习题要求:要求:(1) 先判断定量资料所对应的实验设计类型;(2) 假定资料满足参数检验的前提条件,请选用相应设计的定量资料的方差分析,并用SAS 软件实现统计计算;(3) 摘录主要计算结果并合理解释,给出统计学结论和专业结论。

时间序列分析上机操作题

时间序列分析上机操作题

20。

1971年9月-1993年6月澳大利亚季度常住人口变动(单位:千人)情况如下表.问题:(1)判断该序列的平稳性与纯随机性。

(2)选择适当模型拟合该序列的发展.(3)绘制该序列拟合及未来5年预测序列图.针对问题一:将以下程序输入SAS编辑窗口,然后运行后可得图1.data example3_1;input x@@;time=_n_;cards;63。

2 67。

9 55.8 49。

5 50。

2 55。

4 49。

9 45。

3 48.1 61.7 55.2 53。

1 49.5 59。

9 30。

6 30.4 33.8 42.1 35.8 28。

4 32.9 44.1 45.5 36。

6 39.5 49.8 48。

8 29 37.3 34。

2 47。

6 37.3 39。

2 47。

6 43。

9 49 51.2 60。

8 67 48.9 65.4 65.4 67.6 62.5 55.1 49。

6 57.3 47.3 45。

5 44。

5 48 47.9 49.1 48。

8 59。

4 51。

6 51。

4 60.9 60。

9 55。

8 58.6 62.1 64 60。

3 64.6 71 79.4 59。

9 83.4 75.4 80.2 55.9 58.5 65.2 69.5 59。

1 21。

5 62.5 170 -47.4 62。

2 60 33。

1 35。

3 43.4 42。

7 58。

4 34。

4;proc gplot data=example3_1;plot x*time=1;symbol1c=red I=join v=star;run;图1 该序列的时序图由图1可读出:除图中170和-47。

4这两个异常数据外,该时序图显示澳大利亚季度常住人口变动一般在在60附近随机波动,没有明显的趋势或周期,基本可视为平稳序列.再接着输入以下程序运行后可输出五方面的信息。

具体见表1-表5.proc arima data= example3_1;identify Var=x nlag=8;run;表1 分析变量的描述性统计从表1可读出分析变量的名称、该序列的均值;标准差及观察值的个数(样本容量)。

SAS上机练习试题[全部,含参考答案解析]

SAS上机练习试题[全部,含参考答案解析]

重庆医科大学--卫生统计学统计软件包SAS上机练习题(一)1、SAS常用的窗口有哪三个?请在三个基本窗口之间切换并记住这些命令或功能键。

2、请在PGM窗口中输入如下几行程序,提交系统执行,并查看OUTPUT窗和LOG窗中内容,注意不同颜色的含义;并根据日志窗中的信息修改完善程序。

3、将第2题的程序、结果及日志保存到磁盘。

4、试根据如下例1的程序完成后面的问题:表1 某班16名学生3门功课成绩表如下问题:1)建立数据集;2)打印至少有1门功课不及格同学的信息;(提示,使用if语句)参考程序:data a;input id sh wl bl;cards;083 68 71 65084 74 61 68085 73 75 46086 79 80 79087 75 71 68084 85 85 87085 78 79 75086 80 76 79087 85 80 82088 77 71 75089 67 73 71080 75 81 70118 70 54 75083 70 66 84084 62 73 65099 82 70 79;run;data b;set a;if sh<60 or wl<60 or bl<60then output;run;proc print data=b;var id sh wl bl;run;5、根据下列数据建立数据集表2 销售数据开始时间终止时间费用2005/04/28 25MAY2009 $123,345,0002005 09 18 05OCT2009 $33,234,5002007/08/12 22SEP2009 $345,60020040508 30JUN2009 $432,334,500提示:(格式化输入;数据之间以空格分隔,数据对齐;注意格式后面的长度应以前一个位置结束开始计算,如果读入错误,可试着调整格式的宽度;显示日期需要使用输出格式)开始时间,输入格式yymmdd10.终止时间,输入格式date10.费用,输入格式dollar12.参考程序:data a;input x1 yymmdd10. x2 date10. x3 dollar13.;cards;2005/04/28 25MAY2009 $123,345,0002005 09 18 05OCT2009 $33,234,5002007/08/12 22SEP2009 $345,60020040508 30JUN2009 $432,334,500;run;proc print;run;proc print;format x1 yymmdd10. x2 date9. x3 dollar13.;run;6、手机号码一编码规则一般是:YYY-XXXX-ZZZZ,其YYY为号段;XXXX一般为所在地区编码;ZZZZ为对应的个人识别编号。

医学统计学SAS上机考试

医学统计学SAS上机考试

1-性别-卡方-和年龄-T-的两组比较The FREQ ProcedureTable of sex by groupsex(sex) group(group)频 数Frequency|列百分比Col Pct | 1| 2| Total---------+--------+--------+1 | 38 | 43 | 81| 31.15 | 36.44 |---------+--------+--------+2 | 84 | 75 | 159| 68.85 | 63.56 |---------+--------+--------+Total 122 118 240Statistics for Table of sex by groupStatistic DF Value Prob卡方 Chi-Square 1 0.7516 0.3860 N≥40且T≥5连续矫正卡方Continuity Adj. Chi-Square 1 0.5335 0.4651 N≥40且1≤T<5Fisher's Exact Test F确切检验Two-sided Pr <= P 0.4146 N≤40或T<1性别 实验组 对照组 合计男 38 43 81女 84 75 159合计 122 118 240建立检验假设,确定检验水平:H0:不同组男女构成比相等,π1=π2H1:不同组男女构成比不同,π1≠π2α=0.05计算检验统计量,求得P值。

统计推断结论:P>0.05,按α=0.05水平不拒绝H0,差异无统计学意义,根据现有资料认为:The TTEST ProcedureLower CL Upper CL Lower CL Upper CLVariable group N Mean Mean Mean Std Dev Std Dev Std Dev Std Errage 1 122 34.941 37.025 39.108 10.327 11.625 13.3 1.0525age 2 118 34.959 36.89 38.82 9.3889 10.589 12.144 0.9748T-TestsVariable Method Variances DF t Value Pr > |t|age Pooled Equal 238 0.09 0.9254 方差齐age Satterthwaite Unequal 237 0.09 0.9252 方差不齐Equality of VariancesVariable Method Num DF Den DF F Value Pr > Fage Folded F 121 117 1.21 0.3107 P>0.05方差齐P<0.05不齐实验组 对照组组别P值MEAN STD MEAN STD年龄 37.025 11.625 36.89 10.589 0.9254建立检验假设,确定检验水平:H0:不同组平均年龄相等,μ1=μ2H1:不同组平均年龄不同,μ1≠μ2α=0.05计算检验统计量,求得P值。

SAS认证220道_练习题及详细答案(10-9)

SAS认证220道_练习题及详细答案(10-9)

SAS Certificate Base Practice Questions and Detailed Answers Chapter 1: Basic ConceptsChapter 2: Referencing Files and Setting OptionsChapter 3: Editing and Debugging SAS ProgramsChapter 4: Creating List ReportsChapter 5: Creating SAS Data Sets from Raw DataChapter 6: Understanding DATA Step ProcessingChapter 7: Creating and Applying User-Defined FormatsChapter 8: Creating Enhanced List and Summary ReportsChapter 9: Producing Descriptive StatisticsChapter 10: Producing HTML OutputChapter 11: Creating and Managing VariablesChapter 12: Reading SAS Data SetsChapter 13: Combining SAS Data SetsChapter 14: Transforming Data with SAS FunctionsChapter 15: Generating Data with DO LoopsChapter 16: Processing Variables with ArraysChapter 17: Reading Raw Data in Fixed FieldsChapter 18: Reading Free-Format DataChapter 19: Reading Date and Time ValuesChapter 20: Creating a Single Observation from Multiple RecordsChapter 21: Creating Multiple Observations from a Single RecordChapter 22: Reading Hierarchical FilesChapter 1: Basic Concepts Answer Key1.How many observations and variables does the data set below contain?a. 3 observations, 4 variablesb. 3 observations, 3 variablesc. 4 observations, 3 variablesd.can't tell because some values are missingCorrect answer:cRows in the data set are called observations, and columns are called variables. Missing values don't affect the structure of the data set.2.How many program steps are executed when the program below is processed?data user.tables;infile jobs;input date name $ job $;run;proc sort data=user.tables;by name;run;proc print data=user.tables;run;a.threeb.fourc.fived.sixCorrect answer:aWhen it encounters a DATA, PROC, or RUN statement, SAS stops reading statements andexecutes the previous step in the program. The program above contains one DATA step and two PROC steps, for a total of three program steps.3.What type of variable is the variable AcctNum in the data set below?a.numericb.characterc.can be either character or numericd.can't tell from the data shownCorrect answer:bIt must be a character variable, because the values contain letters and underscores, which are not valid characters for numeric values.4.What type of variable is the variable Wear in the data set below?a.numericb.characterc.can be either character or numericd.can't tell from the data shownCorrect answer:aIt must be a numeric variable, because the missing value is indicated by a period rather than by a blank.5.Which of the following variable names is valid?a.4BirthDateb.$Costc._Items_d.Tax-RateCorrect answer:cVariable names follow the same rules as SAS data set names. They can be 1 to 32 characters long, must begin with a letter (A–Z, either uppercase or lowercase) or an underscore, and can continue with any combination of numbers, letters, or underscores.6.Which of the following files is a permanent SAS file?a.Sashelp.PrdSaleb.Sasuser.MySalesc.Profits.Quarter1d.all of the aboveCorrect answer:dTo store a file permanently in a SAS data library, you assign it a libref other than the default Work. For example, by assigning the libref Profits to a SAS data library, you specify that files within the library are to be stored until you delete them. Therefore, SAS files in the Sashelp and Sasuser libraries are permanent files.7.In a DATA step, how can you reference a temporary SAS data set named Forecast?a.Forecastb.Work.Forecastc.Sales.Forecast (after assigning the libref Sales)d.only a and b aboveCorrect answer:dTo reference a temporary SAS file in a DATA step or PROC step, you can specify the one-level name of the file (for example, Forecast) or the two-level name using the libref Work (for example, Work.Forecast).8.What is the default length for the numeric variable Balance?a. 5b. 6c.7d.8Correct answer:dThe numeric variable Balance has a default length of 8. Numeric values (no matter how many digits they contain) are stored in 8 bytes of storage unless you specify a different length.9.How many statements does the following SAS program contain?proc print data=new.prodsalelabel double;var state day price1 price2; where state='NC';label state='Name of State';run;a.threeb.fourc.fived.sixCorrect answer:cThe five statements are•PROC PRINT statement (two lines long)•VAR statement•WHERE statement (on the same line as the VAR statement)•LABEL statement•RUN statement (on the same line as the LABEL statement).10.What is a SAS data library?a. a collection of SAS files, such as SAS data sets and catalogsb.in some operating environments, a physical collection of SAS filesc.in some operating environments, a logically related collection of SAS filesd.all of the aboveCorrect answer:dEvery SAS file is stored in a SAS data library, which is a collection of SAS files, such as SAS data sets and catalogs. In some operating environments, a SAS data library is a physical collection of files. In others, the files are only logically related. In the Windows and UNIX environments, a SAS data library is typically a group of SAS files in the same folder or directory.Chapter 2: Referencing Files and Setting Options1.If you submit the following program, how does the output look?options pagesize=55 nonumber;proc tabulate data=clinic.admit;class actlevel;var age height weight;table actlevel,(age height weight)*mean;run;options linesize=80;proc means data=clinic.heart min max maxdec=1;var arterial heart cardiac urinary;class survive sex;run;a.The PROC MEANS output has a print line width of 80 characters, but the PROCTABULATE output has no print line width.b.The PROC TABULATE output has no page numbers, but the PROC MEANS outputhas page numbers.c.Each page of output from both PROC steps is 55 lines long and has no page numbers,and the PROC MEANS output has a print line width of 80 characters.d.The date does not appear on output from either PROC step.Correct: answer:cWhen you specify a system option, it remains in effect until you change the option or end your SAS session, so both PROC steps generate output that is printed 55 lines per page with no page numbers. If you don't specify a system option, SAS uses the default value for that system option.2.In order for the date values 05May1955 and 04Mar2046 to be read correctly, what value mustthe YEARCUTOFF= option have?a. a value between 1947 and 1954, inclusiveb.1955 or higherc.1946 or higherd.any valueCorrect answer:dAs long as you specify an informat with the correct field width for reading the entire date value, the YEARCUTOFF= option doesn't affect date values that have four-digit years.3.When you specify an engine for a library, you are always specifyinga.the file format for files that are stored in the library.b.the version of SAS that you are using.c.access to other software vendors' files.d.instructions for creating temporary SAS files.Correct answer:aA SAS engine is a set of internal instructions that SAS uses for writing to and reading from files in a SAS library. Each engine specifies the file format for files that are stored in the library, which in turn enables SAS to access files with a particular format. Some engines access SAS files, and other engines support access to other vendors' files.4.Which statement prints a summary of all the files stored in the library named Area51?a.proc contents data=area51._all_ nods;b.proc contents data=area51 _all_ nods;c.proc contents data=area51 _all_ noobs;d.proc contents data=area51 _all_.nods;Correct answer:aTo print a summary of library contents with the CONTENTS procedure, use a period to append the _ALL_ option to the libref. Adding the NODS option suppresses detailed information about the files.5.The following PROC PRINT output was created immediately after PROC TABULATEoutput. Which SAS system options were specified when the report was created?a.OBS=, DATE, and NONUMBERb.PAGENO=1, and DATEc.NUMBER and DATE onlyd.none of the aboveCorrect answer:bClearly, the DATE and PAGENO= options are specified. Because the page number on the output is 1, even though PROC TABULATE output was just produced. If you don't specify PAGENO=, all output in the Output window is numbered sequentially throughout your SAS session.6.Which of the following programs correctly references a SAS data set named SalesAnalysisthat is stored in a permanent SAS library?a.data saleslibrary.salesanalysis;set mydata.quarter1sales;if sales>100000;run;b.data mysales.totals;set sales_99.salesanalysis;if totalsales>50000;run;c.proc print data=salesanalysis.quarter1;var sales salesrep month;run;d.proc freq data=1999data.salesanalysis;tables quarter*sales; run;Correct answer:bLibrefs must be 1 to 8 characters long, must begin with a letter or underscore, and can contain only letters, numbers, or underscores. After you assign a libref, you specify it as the first element in the two-level name for a SAS file.7.Which time span is used to interpret two-digit year values if the YEARCUTOFF= option isset to 1950?a.1950-2049b.1950-2050c.1949-2050d.1950-2000Correct answer:aThe YEARCUTOFF= option specifies which 100-year span is used to interpret two-digit year values. The default value of YEARCUTOFF= is 1920. However, you can override the default and change the value of YEARCUTOFF= to the first year of another 100-year span. If you specify YEARCUTOFF=1950, then the 100-year span will be from 1950 to 2049.8.Asssuming you are using SAS code and not special SAS windows, which one of thefollowing statements is false?a.LIBNAME statements can be stored with a SAS program to reference the SAS libraryautomatically when you submit the program.b.When you delete a libref, SAS no longer has access to the files in the library.However, the contents of the library still exist on your operating system.c.Librefs can last from one SAS session to another.d.You can access files that were created with other vendors' software by submitting aLIBNAME statement.Correct answer:cThe LIBNAME statement is global, which means that librefs remain in effect until you modify them, cancel them, or end your SAS session. Therefore, the LIBNAME statement assigns the libref for the current SAS session only. You must assign a libref before accessingSAS files that are stored in a permanent SAS data library.9.What does the following statement do?libname osiris spss 'c:\myfiles\sasdata\data';a.defines a library called Spss using the OSIRIS engineb.defines a library called Osiris using the SPSS enginec.defines two libraries called Osiris and Spss using the default engined.defines the default library using the OSIRIS and SPSS enginesCorrect answer:bIn the LIBNAME statement, you specify the library name before the engine name. Both are followed by the path.10.What does the following OPTIONS statement do?options pagesize=15 nodate;a.suppresses the date and limits the page size of the logb.suppresses the date and limits the vertical page size for text outputc.suppresses the date and limits the vertical page size for text and HTML outputd.suppresses the date and limits the horizontal page size for text outputCorrect answer:bThese options affect the format of listing output only. NODATE suppresses the date and PAGESIZE= determines the number of rows to print on the page.Chapter 3: Editing and Debugging SAS Programs Answer Key1.As you write and edit SAS programs it's a good idea toa.begin DATA and PROC steps in column one.b.indent statements within a step.c.begin RUN statements in column one.d.all of the aboveCorrect answer:dAlthough you can write SAS statements in almost any format, a consistent layout enhances readability and enables you to understand the program's purpose. It's a good idea to begin DATA and PROC steps in column one, to indent statements within a step, to begin RUN statements in column one, and to include a RUN statement after every DATA step or PROC step.2.What usually happens when an error is detected?a.SAS continues processing the step.b.SAS continues to process the step, and the log displays messages about the error.c.SAS stops processing the step in which the error occurred, and the log displaysmessages about the error.d.SAS stops processing the step in which the error occurred, and the program outputdisplays messages about the error.Correct answer:cSyntax errors generally cause SAS to stop processing the step in which the error occurred. When a program that contains an error is submitted, messages regarding the problem also appear in the SAS log. When a syntax error is detected, the SAS log displays the word ERROR, identifies the possible location of the error, and gives an explanation of the error.3. A syntax error occurs whena.some data values are not appropriate for the SAS statements that are specified in aprogram.b.the form of the elements in a SAS statement is correct, but the elements are not validfor that usage.c.program statements do not conform to the rules of the SAS language.d.none of the aboveCorrect canswer:Syntax errors are common types of errors. Some SAS system options, features of the Editorwindow, and the DATA step debugger can help you identify syntax errors. Other types oferrors include data errors, semantic errors, and execution-time errors.4.How can you tell whether you have specified an invalid option in a SAS program?a. A log message indicates an error in a statement that seems to be valid.b. A log message indicates that an option is not valid or not recognized.c.The message "PROC running" or "DATA step running" appears at the top of theactive window.d.You can't tell until you view the output from the program.Correct answer:bWhen you submit a SAS statement that contains an invalid option, a log message notifies you that the option is not valid or not recognized. You should recall the program, remove or replace the invalid option, check your statement syntax as needed, and resubmit the corrected program.5.Which of the following programs contains a syntax error?Correct answer:bThe DATA step contains a misspelled keyword (dat instead of data). However, this is such a common (and easily interpretable) error that SAS produces only a warning message, not an error.6.What does the following log indicate about your program?proc print data=sasuser.cargo99var origin dest cargorev;2276ERROR 22-322: Syntax error, expecting one of the following:;, (, DATA, DOUBLE, HEADING, LABEL, N, NOOBS, OBS, ROUND, ROWS, SPLIT, STYLE,UNIFORM, WIDTH.ERROR 76-322: Syntax error, statement will be ignored.11 run;a.SAS identifies a syntax error at the position of the VAR statement.b.SAS is reading VAR as an option in the PROC PRINT statement.c.SAS has stopped processing the program because of errors.d.all of the aboveCorrect answer:dBecause there is a missing semicolon at the end of the PROC PRINT statement, SAS interprets VAR as an option in PROC PRINT and finds a syntax error at that location. SAS stops processing programs when it encounters a syntax error.Chapter 4: Creating List Reports Answer Key 1.Which PROC PRINT step below creates the following output?Correct answer:cThe DATA= option specifies the data set that you are listing, and the ID statement replaces the Obs column with the specified variable. The VAR statement specifies variables and controls the order in which they appear, and the WHERE statement selects rows based on a condition. The LABEL option in the PROC PRINT statement causes the labels that are specified in the LABEL statement to be displayed.2.Which of the following PROC PRINT steps is correct if labels are not stored with thedata set?Correct aanswer:You use the DATA= option to specify the data set to be printed. The LABEL optionspecifies that variable labels appear in output instead of variable names.3.Which of the following statements selects from a data set only those observations forwhich the value of the variable Style is RANCH, SPLIT, or TWOSTORY?Correct answer:dIn the WHERE statement, the IN operator enables you to select observations based on several values. You specify values in parentheses and separate them by spaces or commas. Character values must be enclosed in quotation marks and must be in the same case as in the data set.4.If you want to sort your data and create a temporary data set named Calc to store thesorted data, which of the following steps should you submit?Correct answer:cIn a PROC SORT step, you specify the DATA= option to specify the data set to sort. The OUT= option specifies an output data set. The required BY statement specifies the variable(s) to use in sorting the data.5.Which options are used to create the following PROC PRINT output?13:27 Monday, March 22, 1999 Patient Arterial Heart Cardiac Urinary203 88 95 66 11054 83 183 95 0664 72 111 332 12210 74 97 369 0101 80 130 291 0a.the DATE system option and the LABEL option in PROC PRINTb.the DATE and NONUMBER system options and the DOUBLE and NOOBSoptions in PROC PRINTc.the DATE and NONUMBER system options and the DOUBLE option inPROC PRINTd.the DATE and NONUMBER system options and the NOOBS option in PROCPRINTCorrect answer:bThe DATE and NONUMBER system options cause the output to appear with the date but without page numbers. In the PROC PRINT step, the DOUBLE option specifies double spacing, and the NOOBS option removes the default Obs column.6.Which of the following statements can you use in a PROC PRINT step to create thisoutput?Correct answer:dYou do not need to name the variables in a VAR statement if you specify them in the SUM statement, but you can. If you choose not to name the variables in the VAR statement as well, then the SUM statement determines the order of the variables in the output.7.What happens if you submit the following program?proc sort data=clinic.diabetes;run;proc print data=clinic.diabetes;var age height weight pulse;where sex='F';run;a.The PROC PRINT step runs successfully, printing observations in their sortedorder.b.The PROC SORT step permanently sorts the input data set.c.The PROC SORT step generates errors and stops processing, but the PROCPRINT step runs successfully, printing observations in their original (unsorted)order.d.The PROC SORT step runs successfully, but the PROC PRINT step generateserrors and stops processing.Correct answer:cThe BY statement is required in PROC SORT. Without it, the PROC SORT step fails. However, the PROC PRINT step prints the original data set as requested.8.If you submit the following program, which output does it create?proc sort data=finance.loans out=work.loans;by months amount;run;proc print data=work.loans noobs; var months;sum amount payment;where months<360;run;a.b.c.d.Correct answer:aColumn totals appear at the end of the report in the same format as the values of the variables, so b is incorrect. Work.Loans is sorted by Month and Amount, so c isincorrect. The program sums both Amount and Payment, so d is incorrect.9.Choose the statement below that selects rows which•the amount is less than or equal to $5000•the account is 101-1092 or the rate equals 0.095.Correct answer:cTo ensure that the compound expression is evaluated correctly, you can use parentheses to groupaccount='101-1092' or rate eq 0.095OBS Account Amount Rate MonthsPayment1 101-1092 $22,000 10.00%60 $467.432 101-1731 $114,0009.50% 360 $958.573 101-1289 $10,000 10.50%36 $325.024 101-3144 $3,500 10.50%12 $308.525 103-1135 $8,700 10.50%24 $403.476 103-1994 $18,500 10.00%60 $393.077 103-2335 $5,000 10.50%48 $128.028 103-3864 $87,500 9.50% 360 $735.759 103-3891 $30,000 9.75% 360 $257.75For example, from the data set above, a and b above select observations 2 and 8 (those that have a rate of 0.095); c selects no observations; and d selects observations 4 and 7 (those that have an amount less than or equal to 5000).10.What does PROC PRINT display by default?a.PROC PRINT does not create a default report; you must specify the rows andcolumns to be displayed.b.PROC PRINT displays all observations and variables in the data set. If youwant an additional column for observation numbers, you can request it.c.PROC PRINT displays columns in the following order: a column forobservation numbers, all character variables, and all numeric variables.d.PROC PRINT displays all observations and variables in the data set, a columnfor observation numbers on the far left, and variables in the order in which they occur in the data set.Correct answer:dYou can remove the column for observation numbers. You can also specify the variables you want, and you can select observations according to conditions.Chapter 5: Creating SAS Data Sets from Raw Data Answer Key1.Which SAS statement associates the fileref Crime with the raw data fileC:\States\Data\Crime?a.filename crime 'c:\states\data\crime';b.filename crime c:\states\data\crime;c.fileref crime 'c:\states\data\crime';d.filename 'c:\states\data\crime' crime; Correct aanswer:Before you can read your raw data, you must reference the raw data file by creating afileref. You assign a fileref by using a FILENAME statement in the same way thatyou assign a libref by using a LIBNAME statement.2.Filerefs remain in effect untila.you change them.b.you cancel them.c.you end your SAS session.d.all of the aboveCorrect answer:dLike LIBNAME statements, FILENAME statements are global; they remain in effect until you change them, cancel them, or end your SAS session.3.Which statement identifies the name of a raw data file to be read with the filerefProducts and specifies that the DATA step read only records 1-15?a.infile products obs 15;b.infile products obs=15;c.input products obs=15;d.input products 1-15;Correct answer:bYou use an INFILE statement to specify the raw data file to be read. You can specify a fileref or an actual filename (in quotation marks). The OBS= option in the INFILE statement enables you to process only records 1 through n.4.Which of the following programs correctly writes the observations from the data setbelow to a raw data file?Correct answer:dThe keyword _NULL_ in the DATA statement enables you to use the power of the DATA step without actually creating a SAS data set. You use the FILE and PUT statements to write out the observations from a SAS data set to a raw data file. The FILE statement specifies the raw data file and the PUT statement describes the lines towrite to the raw data file. The filename and location that are specified in the FILE statement must be enclosed in quotation marks.5.Which raw data file can be read using column input?a.b.c.d.all of the aboveCorrect answer:bColumn input is appropriate only in some situations. When you use column input, your data must be standard character or numeric values, and they must be in fixed fields. That is, values for a particular variable must be in the same location in all records.6.Which program creates the output shown below?Correct answer:aThe INPUT statement creates a variable using the name that you assign to each field. Therefore, when you write an INPUT statement, you need to specify the variable names exactly as you want them to appear in the SAS data set.7.Which statement correctly reads the fields in the following order: StockNumber,Price, Item, Finish, Style?Field Name Start Column End Column Data TypeStockNumber 1 3 characterFinish 5 9 characterStyle 11 18 characterItem 20 24 characterPrice 27 32 numericCorrec t answer:bYou can use column input to read fields in any order. You must specify the variable name to be created, identify character values with a $, and name the correct starting column and ending column for each field.8.Which statement correctly re-defines the values of the variable Income as 100percent higher?a.income=income*1.00;b.income=income+(income*2.00);c.income=income*2;d.income=*2;Correct answer:cTo re-define the values of the variable Income in an Assignment statement, you specify the variable name on the left side of the equal sign and an appropriate expression including the variable name on the right side of the equal sign.9.Which program correctly reads instream data?a.data finance.newloan;input datalines;if country='JAPAN';MonthAvg=amount/12;1998 US CARS 194324.121998 US TRUCKS 142290.301998 CANADA CARS 10483.441998 CANADA TRUCKS 93543.641998 MEXICO CARS 22500.571998 MEXICO TRUCKS 10098.881998 JAPAN CARS 15066.431998 JAPAN TRUCKS 40700.34;b.data finance.newloan;input Year 1-4 Country $ 6-11Vehicle $ 13-18 Amount 20-28;if country='JAPAN';MonthAvg=amount/12;datalines;run;c.data finance.newloan;input Year 1-4 Country 6-11Vehicle 13-18 Amount 20-28;if country='JAPAN';MonthAvg=amount/12;datalines;1998 US CARS 194324.121998 US TRUCKS 142290.301998 CANADA CARS 10483.441998 CANADA TRUCKS 93543.641998 MEXICO CARS 22500.571998 MEXICO TRUCKS 10098.881998 JAPAN CARS 15066.431998 JAPAN TRUCKS 40700.34;d.data finance.newloan;input Year 1-4 Country $ 6-11Vehicle $ 13-18 Amount 20-28;if country='JAPAN';MonthAvg=amount/12;datalines;1998 US CARS 194324.121998 US TRUCKS 142290.301998 CANADA CARS 10483.441998 CANADA TRUCKS 93543.641998 MEXICO CARS 22500.571998 MEXICO TRUCKS 10098.881998 JAPAN CARS 15066.431998 JAPAN TRUCKS 40700.34;Correct answer:dTo read instream data, you specify a DATALINES statement and data lines, followed by a null statement (single semicolon) to indicate the end of the input data. Program a contains no DATALINES statement, and the INPUT statement doesn't specify the fields to read. Program b contains no data lines, and the INPUT statement in program c doesn't specify the necessary dollar signs for the character variables Country and Vehicle.10.Which SAS statement subsets the raw data shown below so that only the observationsin which Sex (in the second field) has a value of F are processed?a.if sex=f;b.if sex=F;c.if sex='F';d. a or bCorrect answer:cTo subset data, you can use a subsetting IF statement in any DATA step to process only those observations that meet a specified condition. Because Sex is a character variable, the value F must be enclosed in quotation marks and must be in the same case as in the data set.Chapter 6: Understanding DATA Step Processing Answer Key1.Which of the following is not created during the compilation phase?。

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

重庆医科大学--卫生统计学统计软件包SAS上机练习题(一)1、SAS常用的窗口有哪三个?请在三个基本窗口之间切换并记住这些命令或功能键。

2、请在PGM窗口中输入如下几行程序,提交系统执行,并查看OUTPUT窗和LOG窗中内容,注意不同颜色的含义;并根据日志窗中的信息修改完善程序。

3、将第2题的程序、结果及日志保存到磁盘。

4、试根据某班12名学生3门功课成绩表完成后面的问题:问题:1)建立数据集;2)打印至少有1门功课不及格同学的信息;(提示,使用if语句)5、(选做)根据下列数据建立数据集表2销售数据开始时间终止时间费用2005/04/28 25MAY2009 $123,345,0002005 09 18 05OCT2009 $33,234,500提示:(计算,如果读入错误,可试着调整格式的宽度;显示日期需要使用输出格式)开始时间,输入格式yymmdd10.终止时间,输入格式date10.费用,输入格式dollar12.6、手机号码一编码规则一般是:YYY-XXXX-ZZZZ,其YYY为号段;XXXX一般为所在地区编码;ZZZZ为对应的个人识别编号。

下面有一组电话号码(来源于网络,末位以X替换),请用程序完成下列要求:(1)分别列出属于联通、移动、电信的号码;(2)分别提取地区编号及个人识别编号。

(提示:列输入方式或者字符串操作)说明:移动:134-139、150、151、152、157、158、159、188联通:130、131、132、155、156电信:133、153、180、1897、下表是某班学生几门功课的成绩,其中形势课是考查课,其它均为考试课。

请完成以下处理并且保存程序、结果和日志:(注意函数在DATA STEP中使用的位置)(1)用Mean()函数求出每位同学的平均分,将其保存在变量中;(2)用sum()函数或者表达式求出每位同学的总分,将其保存在变量中;(3)如果每门考试课权重是0.75,每门考查课权重为0.25,试求每位同学的加权平均分;(4)将数据集保存为永久数据集,保存位置为“D:\mydata\”;表3某班同学几门功课的成绩8、下面是3个大类疾病的ICD-10编码及对应的疾病名。

请完成以下任务:(1)建立数据集;(2)提取每种疾病的大类编码;(3)分别将3个大类的疾病存入3个数据集。

(提示:ICD10编码中小数点前面的三位表示大类;length语句定义字符变量长度;字符串取子串函数)表44类疾病的ICD10编码及对应疾病名ICD10 DiseaseA01.001 伤寒A01.002 伤寒杆菌性败血症A01.101 甲型副伤寒A01.201 乙型副伤寒A01.301 丙型副伤寒A01.401 副伤寒A02.001 B群沙门氏菌肠炎A02.002 C群沙门氏菌肠炎A02.004 沙门氏菌性肠炎A02.006 沙门氏菌胃肠炎A02.007 鼠伤寒沙门氏菌性肠炎A02.008 婴儿沙门氏菌肠炎A02.101 沙门氏菌败血症A02.901 沙门氏菌感染A02.902 鼠伤寒沙门氏菌感染A02.903 沙门氏菌属食物中毒A03.001 什密氏志贺菌痢疾A03.101 弗氏志贺菌痢疾A03.201 鲍氏志贺菌痢疾A03.301 宋内氏志贺菌痢疾A03.802 菌痢混合感染A03.901 细菌性痢疾A03.902 慢性细菌性痢疾急性发作A03.903 慢性细菌性痢疾A03.906 中毒性痢疾9、现有两个文件,内容如下:要求:(1)根据A、B(2)打印至少有一门功课不及格的同学的年龄、性别和班级。

10、某研究员欲分析急性染毒对肝脏功能的影响,将40只小鼠分为两组,雄雌各半,试验组进行急性染毒试验,染毒后2小时测定血液中的ALT,整理的结果见下表。

要求:根据上面的数据建立恰当的SAS数据集11、某职业病防治所对30名矿工分别测定血清铜蓝蛋白含量(μmol/L),资料如下。

问各期血清铜蓝蛋白含量的测定结果有无差别?疾病分期测定结果0期8.0 9.0 5.8 6.3 5.4 8.5 5.6 5.4 5.5 7.2 5.6I期8.5 4.3 11.0 9.0 6.7 9.0 10.5 7.7 7.7II期11.3 7.0 9.5 8.5 9.6 10.8 9.0 12.6 13.9 6.5要求:根据上面的数据建立恰当的SAS数据集12、24名志愿者随机分成两组,每组12人,接受降胆固醇试验,甲组为特殊饮食组,乙组为药物治疗组。

受试者试验前后各测量一次血清胆固醇(mmol/L),数据见下表:甲组乙组受试者试验前试验后受试者试验前试验后1 6.11 6.00 1 6.90 6.932 6.81 6.83 2 6.40 6.353 6.48 4.49 3 6.48 6.414 7.59 7.28 4 7.00 7.105 6.42 6.30 5 6.53 6.416 6.94 6.64 6 6.70 6.687 9.17 8.42 7 9.10 9.058 7.33 7.00 8 7.31 6.839 6.94 6.58 9 6.96 6.9110 7.67 7.22 10 6.81 6.7311 8.15 6.57 11 8.16 7.65(彭斌,2012-11-6)SAS上机练习题(二)1、某农村地区1999年14岁女孩的身高资料列于表1。

表1 谋农村地区1999年14岁女孩身高资料(cm)142.3 148.8 142.7 144.4 144.7 145.1 143.3 154.2 152.3 142.7 156.6137.9 143.9 141.2 139.3 145.8 142.2 137.9 141.2 150.6 142.7 151.3142.4 141.5 141.9 147.9 125.8 139.9 148.9 154.9 145.7 140.8 139.6148.8 147.8 146.7 132.7 149.7 154.0 158.2 138.2 149.8 151.1 140.1140.5 143.4 152.9 147.5 147.7 162.6 141.6 143.6 144.0 150.6 138.9150.8 147.9 136.9 146.5 130.6 142.5 149.0 145.4 139.5 148.9 144.5141.8 148.1 145.4 134.6 130.5 145.2 146.2 146.4 142.4 137.1 141.4144.0 129.4 142.8 132.1 141.8 143.3 143.8 134.7 147.1 140.9 137.4142.5 146.6 135.5 146.8 156.3 150.0 147.3 142.9 141.4 134.7 138.5146.6 134.5 135.1 141.9 142.1 138.1 134.9 146.7 138.5 139.6 139.2148.8 150.3 140.7 143.5 140.2 143.6 138.7 138.9 143.5 139.9 134.4133.1 145.9 139.2 137.4 142.3 160.9 137.7 142.9 126.8问题:(1)计算均数、中位数;计算均数的95%可信区间;(2)计算四分位间距、标准差、变异系数;计算标准误;(3)请进行正态性检验;(4)观察频数分布情况;2、(t检验、配对t检验)24名志愿者随机分成两组,每组12人,接受降胆固醇试验,甲组为特殊饮食组,乙组为药物治疗组。

受试者试验前后各测量一次血清胆固醇(mmol/L),数据见下表:甲组乙组受试者试验前试验后受试者试验前试验后1 6.11 6.00 1 6.90 6.932 6.81 6.83 2 6.40 6.353 6.48 4.49 3 6.48 6.414 7.59 7.28 4 7.00 7.105 6.42 6.30 5 6.53 6.416 6.94 6.64 6 6.70 6.687 9.17 8.42 7 9.10 9.058 7.33 7.00 8 7.31 6.839 6.94 6.58 9 6.96 6.9110 7.67 7.22 10 6.81 6.7311 8.15 6.57 11 8.16 7.6512 6.60 6.17 12 6.98 6.52问题:(1)试建立能够满足以下统计分析的SAS数据集。

(2)试判断两组受试者试验前血清胆固醇水平是否相等?(3)分别判断两种降胆固醇措施是否有效?(4)试判断两种降胆固醇措施的效果是否相同?3、(秩和检验)某职业病防治所对30名矿工分别测定血清铜蓝蛋白含量(μmol/L ),资料如下。

问各期血清铜蓝蛋白含量的测定结果有无差别?疾病分期 测定结果0期 8.0 9.0 5.8 6.3 5.4 8.5 5.6 5.4 5.5 7.2 5.6 I 期 8.5 4.3 11.0 9.0 6.7 9.0 10.5 7.7 7.7II 期11.3 7.0 9.5 8.5 9.6 10.8 9.0 12.6 13.9 6.5请用秩和检验完成分析。

请进行以下分析:1) 此次调查中男性的比例为多少;2) 对46级改革之后学习英语的积极性的情况进行描述,三种选择占的比例分别是多少? 3) 男生与女性的对46级改革的反应有无差异; 4) 计算身体质量指数(Body Mass Index ,)()(2m Kg BMI 身高体重),比较男女生的BMI 有无差异?5) 关于BMI某年级的问卷调查数据机器号 性别 身高 体重 开支 英语改革 TB 症状 id sex height weight money question1question2 cnw1l01 1 179 70 5.7 a ABDEF cnw1l02 1 175 70 7.5 a ABE cnw1l03 2 157 47 4.5 a ABE cnw1l04 2 163 48 5 c ABDF cnw1l052161525bABFcnw1r02 2 158 56 6.2 b ABDE cnw1r03 1 168 64 6.5 a ABE cnw1r05 2 150 44 5.5 b ABD cnw1r06 1 162 53 7 b ABDE cnw2l02 2 160 53 8 c ABEF cnw2l03 2 164 58 6 c ABE cnw2l04 1 167 60 7 c ABCDEF cnw2l05 2 164 54 5 c AB cnw2r02 2 151 44 6 b B cnw2r03 2 150 51 7.8 b ABDF cnw2r04 2 160 55 5 b ABE cnw2r05 2 160 47 3.9 b ABEF cnw2r06 2 156 48 8.5 c ABCDEFG cnw3l01 2 162 48 8 c ABDF cnw3l02 1 163 60 7.2 a ABE cnw3l03 1 161 50 7.3 b ADFG cnw3r01 1 169 57 5.3 a ABDF cnw3r02 2 162.5 46.5 7 a ABCDEF cnw3r03 2 155 53 7.5 b ABCDEF cnw3r05 2 163 50 4.4 b ABED cnw3r06 1 163 65 8 b ABCDEF cnw4l01 1 168 60 5 c ABDG cnw4l02 1 178 68 8 a AC cnw4l03 2 158 45 6 c ADEF cnw4l04 1 173 68 8.5 b ABDEF cnw4r01 1 175 53 5 b ABDEF cnw4r02 1 178 69 6 b A cnw4r03 2 158 50 8 b ABDEF cnw4r04 2 165 53 4.5 b ABDE cnw4r05 2 157 46 5.3 b ABE cnw4r06 2 155 48 6.7 c ABD cnw5l01 2 160 49 4.2 b ABDEF cnw5l02 2 160 49 7 a ABE cnw5l03 2 170 57 8.5 c AB cnw5r01 2 160 49 4.2 b ABDE cnw5r02 1 168 65 9.2 a ABDEF cnw5r02 2 170 57 8.5 c AD cnw6l02 2 160 50 4 b ABE cnw6l03 1 181 63 3.5 b ADEF cnw6l04 1 175 53 20 a ABcnw6r02 2 166 54 4.5 c ABDF cnw6r03 2 155 43 5.4 c ABEF cnw6r04 2 153 45 5.4 c EG cnw6r05 2 160 48 5 a AB cnw6r06 2 164 46 7.4 b ABEF cnw7l02 2 160 46 8 b A cnw7l05 1 174 70 7 b ADF cnw7r01 2 155 55 8 c AB cnw7r02 1 168 60 10 c ABEF cnw7r03 1 181 60 10 c ABE cnw7r05 1 166 60 7 c ABDE cnw7r06 2 164 46 7.4 b ABEF cnw8l01 1 160 50 9 c ADF cnw8r01 1 174 70 8 a ADEG cnw8r02 2 172 53 5 c ABE cnw1r01 2 154 49 4.2 C ABDEF cnw1r02 1 169 64 10.4 B ABDE cnw1r04 1 169 67 15 A ABDEFG cnw1r05 2 153 50 10 B ABCD cnw1r06 2 160 50 3.6 A ABE cnw2r02 2 156 46 4 A ADG cnw2r03 1 173 62 7.5 B ABFG cnw2r04 1 168 57 8.9 B ABDF cnw2r05 2 155 45 6 B ABD cnw2r06 1 170 60 7 C ABD cnw3r02 1 162 56 6.3 C ABD cnw3r03 2 161 50 7 B ABE cnw3r04 2 154 48 5 C ABE cnw3r05 2 155 46 6 B ABDF cnw3r06 2 155 51 5 A ABDEG cnw4r02 2 153 50 3.5 C BE cnw4r03 2 150 48 5 A ABDE cnw4r04 2 152.5 46 5.2 A ADE cnw4r05 1 185 70 7.5 A ABDG cnw4r06 1 170 58 6.5 B AD cnw5r01 1 173 62 6 B ABDE cnw5r02 1 168 50 6.1 A ABDE cnw5r03 2 160 50 7 C ABCEF cnw5r04 2 155 42 6 B ABDF cnw5r05 1 168 55 7 B ADFcnw6r01 2 158 50 8.1 C ADF cnw6r02 1 175 61 10.5 B ABDE cnw6r03 2 155 44 11 C ABDE cnw6r04 1 162 60 10 C ADF cnw6r05 1 173 64 15 C ADF cnw7r01 1 175 86 11 C ABE cnw7r02 1 172 62 12 B ABEG cnw7r03 1 172 65 6.3 B ABEG cnw7r05 2 151 48 7 B ABDEFG cnw8r02 1 167 50 9 B ABDEF cnw8r03 2 160 50 5 B ABDEFG cnw8r04 2 170 65 10 B ABDEFG cnw1l01 1 165 47 7.3 B AB cnw1l02 2 152 44 4.2 B AB cnw1l03 2 162 49.5 4.5 B ABE cnw1l04 2 157 52 3.2 B ABE cnw1l05 2 150 45 3.8 A ABE cnw2l02 2 170 55 4.9 B ADF cnw2l03 2 155 47 5.9 B ABDF cnw2l04 2 163 48 5.8 A ADFG cnw2l05 2 150 47.5 8 A ABE cnw3l01 2 153 46 4 B ABDFG cnw3l02 1 165 54 35 A ADF cnw4l01 2 160 52 12.4 A ABDF cnw4l02 1 170 65 5 A D cnw4l04 1 165 51 5 B AF cnw4l05 2 155 42 8 B ABCDE cnw5l01 2 160 45 7 C ABDF cnw5l02 1 179 63 10 C ABDF cnw5l04 1 170 67 9 C ADF cnw6l01 1 170 58 9.6 B ABCDEF cnw6l02 2 160 54 5.5 C ABCDEF cnw6l03 2 155 48 4.4 A ABCDEF cnw6l04 1 170 65 10 C ABCDEF cnw6l05 2 165 47 7 C ABDF cnw7l01 2 150 48 5.8 C ABE cnw7l02 1 160 50 7 A ABCDEF cnw7l03 1 175 66 10 A ABCDEF cnw7l04 2 163 51 8 B ABD cnw7l05 2 165 57 4.9 A ABD cnw8l01 1 160 60 10 B ABE cnw8l02 2 154 50 4.3 A BE cnw8l03 2 160 60 7 A ABDEF教材上的练习题(医学统计学,颜虹主编,人民卫生出版社,第一版)请根据第二版教材相应题目练习。

相关文档
最新文档