sas统计分析代码内容_第1页
sas统计分析代码内容_第2页
sas统计分析代码内容_第3页
sas统计分析代码内容_第4页
sas统计分析代码内容_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、/*统计描述*/*制作频数表*/dataa1;inputx;low= ;dis= ;z=x-mod(x-low,dis);cards;1 23 4;procfreq;tablesz;run;/*用meaNS过程计算例数、均数、标准差、标准误和95%可信区间*/procmeansnmeanstdstderrclm;varx;run;/*用means过程对频数表计算例数、均数、标准差、最大值最小值*/procmeans;freqf;varx;run;procunivariate;freqf;varx;run;/*正态性检验*/procunivariatenormalplot;varx;run;/*

2、t检验*/dataaa3;inputx;y=x-比较的数;/*配对资料d=x1-x2*/cards;procunivariatenormal;vary;run;/*用MEANS作配对资料两个样本均数比较的t检验*/dataex3_6;inputx1 x2 ;d=x1-x2;cards;0.840 0.5800.591 0.5090.674 0.5000.632 0.3160.687 0.3370.978 0.5170.750 0.4540.730 0.5121.200 0.9970.870 0.506;procmeanstprt;vard;run;/*用UNIVARIATE过程作配对资料两样本

3、均数比较的t检验*/procunivariatedata=ex3_6;vard;run;procttestdata=ex3_6;vard;run;dataex3_7;inputx ;if_n_21thenc=1;elsec=2;cards;-0.70 -5.60 2.00 2.80 0.70 3.50 4.00 5.80 7.10 -0.502.50 -1.60 1.70 3.00 0.40 4.50 4.60 2.50 6.00 -1.403.70 6.50 5.00 5.20 0.80 0.20 0.60 3.40 6.60 -1.106.00 3.80 2.00 1.60 2.00 2.

4、20 1.20 3.10 1.70 -2.00;procttest;varx;classc;run;/*方差分析*/DATARANDOM;INPUTX GROUP ;CARDS;3.53 14.59 14.34 12.66 13.59 13.13 12.64 12.56 13.50 13.25 13.30 14.04 13.53 13.56 13.85 14.07 13.52 13.93 14.19 12.96 11.37 13.93 12.33 12.98 14.00 13.55 12.96 14.30 14.16 12.59 12.42 23.36 24.32 22.34 22.68 22

5、.95 21.56 23.11 21.81 21.77 21.98 22.63 22.86 22.93 22.17 22.72 22.65 22.22 22.90 22.97 22.36 22.56 22.52 22.27 22.98 23.72 22.80 23.57 24.02 22.31 22.86 32.28 32.39 32.28 32.48 32.28 33.21 32.23 32.32 32.68 32.66 32.32 32.61 33.64 32.58 33.65 32.66 33.68 32.65 33.02 33.48 32.42 32.41 32.66 33.29 32

6、.70 33.04 32.81 31.97 31.68 30.89 41.06 41.08 41.27 41.63 41.89 41.19 42.17 42.28 41.72 41.98 41.74 42.16 43.37 42.97 41.69 40.94 42.11 42.81 42.52 41.31 42.51 41.88 41.41 43.19 41.92 42.47 41.02 42.10 43.71 4;RUN;/*正态性检验*/PROCUNIVARIATENORMAL;CLASSGROUP;VARX;RUN;PROCANOVA;CLASSGROUP;MODELX=GROUP;ME

7、ANSGROUP/HOVTESTSNKLSDDUNNETT;RUN;/*hovtest方差齐性检验*/*方差分析*/PROCGLM;CLASSGROUP;MODELX=GROUP;MEANSGROUP/HOVTESTSNKLSDDUNNETT;RUN;DATAA;INPUTX TREAT BLOCK ;CARDS;0.82 1 10.73 1 20.43 1 30.41 1 40.68 1 50.65 2 10.54 2 20.34 2 30.21 2 40.43 2 50.51 3 10.23 3 20.28 3 30.31 3 40.24 3 5;RUN;PROCPRINT;RUN;PRO

8、CANOVA;CLASSTREAT BLOCK;MODELX=TREAT BLOCK;MEANSTREAT/SNKALPHA=0.05;MEANSTREAT;RUN;DATABLOCK;INPUTBLOCK TREAT X;CARDS;1 1 0.82 1 2 0.65 1 3 0.512 1 0.73 2 2 0.54 2 3 0.233 1 0.43 3 2 0.34 3 3 0.284 1 0.41 4 2 0.21 4 3 0.315 1 0.68 5 2 0.43 5 3 0.24;PROCANOVA;CLASSBLOCK TREAT;MODELX=BLOCK TREAT;MEANS

9、TREAT/HOVTESTSNKLSDDUNNETT;RUN;PROCGLM;CLASSBLOCK TREAT;MODELX=BLOCK TREAT;MEANSTREAT/HOVTESTSNKLSDDUNNETT;RUN;/*roc曲线分析*/dataex21;inputgroup num;doi=1tonum;inputvalue;output;end;cards;1 256.5 13.5 12.8 6.2 13.9 14.7 9.5 9.0 6.9 16.813.3 10.8 12.2 14.9 13.7 12.8 5.3 11.8 12.47.6 13.3 11.9 11.2 12.3

10、12.70 208.5 6.4 4.6 1.7 9.7 5.3 4.9 5.7 3.8 6.56.3 5.4 3.3 4.7 8.6 6.3 5.9 4.8 4.5 5.2;run;proclogisticdescending;modelgroup=value/scale=noneoutroc=rocl;run;procprint;run;procgplot;plot_SENSIT_*_1MSPEC_;run;DATACHISQGROUP;INPUTCOL ROW X;CARDS;1 1 461 2 62 1 182 2 8;PROCFREQ;WEIGHTX;TABLECOL*ROW/CHIS

11、Q;RUN;DATACHISQPAIRED;/*请注意配对结果中没有进行校正,所以对于需要校正的情况,需要手动计算。但是别的一些软件可以实现校正。*/INPUTCOL ROW X;CARDS;1 1 111 2 122 1 22 2 33;PROCFREQ;WEIGHTX;TABLECOL*ROW/AGREE;RUN;/*行*列表资料注意资料录入格式*/*非参数检验过程步格式*/DATAPAIRED;INPUTX1 X2;D=X1-X2;CARDS;608014215219524380822422402202201902052538212243384423620095100;PROCUNIVA

12、RIATE;VARD;RUN;PROCNPAR1WAY ;BYvariables ;CLASSvariable ;EXACTstatistic-options ;FREQvariable ;OUTPUT ;VARvariables ;RUN;DATAGROUPED;INPUTX GROUP;CARDS;2.7813.2323.2313.5024.2014.0424.8714.1525.1214.2826.2114.3427.1814.4728.0514.6428.5614.7529.6014.8224.9525.102;PROCNPAR1WAY;CLASSGROUP;VARX;RUN;DATA

13、mysas.A1127;INPUTID AGE INDEX;CARDS;1133.542113.01393.09462.48582.566103.367123.18872.65;PROCCORR;VARAGE INDEX;RUN;PROCREG;MODELINDEX=AGESELECTION=STEPWISESLE=0.10SLS=0.10;PLOTINDEX*AGE;RUN;proclogisticdescending;modely=xSELECTION=STEPWISESLE=0.10SLS=0.10;run;/*条件逻辑回归*/dataa;inputi y x1-x6;yy=2-y;pr

14、ocphreg;modelyy*y(0)=x /risklimitsselection=stepwisesle=0.1sls=0.1ties=discrete;STRATA=i;run;/*生存分析km法*/PROCLIFETESTMETHOD=kmPLOTS=(S);TIMEtime*censor(1);STRATAgroup;RUN;dataa;inputtime group censor ;cards;11101151060002540032111241010200281004210174111650029501421018610189014580071102781020000;PROC

15、LIFETESTMETHOD=kmPLOTS=(S);TIMEtime*censor(1);STRATAgroup;RUN;/*生存分析寿命表法km*/DATAsamp12_3;INPUTt censor f ;CARDS;0 1 76 0 0 91 1 68 1 0 82 1 42 2 0 33 1 18 3 0 14 1 9 4 0 05 1 0 5 0 24;PROCPRINT;PROCLIFETESTMETHOD=ltPLOTS=(s)WIDTH=1;TIMEt*censor(0);FREQf;RUN;/*cox回归*/dataa;inputnum sex age stage bloo

16、d xray chmthrp censor day;cards;114522011578203622011154931572210193840452010047175042201114111603921011124571382111144358145221013750913020101395810045210112581110453101135721215721101293813057220111932141492211132051513321011345116051221012363;PROCPHREG;Modelday*censor(0)=sex age stage blood xray

17、chmthrp/risklimits;RUN;/*判别分析*/datad2;doi=1to16;dogrp=1to2;inputid x1 x2 ;output;end;end;cards;1 9.86 5.18 1 10.66 2.072 13.33 3.73 2 12.53 4.4515 13.33 5.96 15 11.20 3.4216 . . 16 9.33 3.63run;procdiscrimdata=d2outstat=outanovamanovapool=testlisterrposterr;classgrp;varx1 x2;priorsprop;run;/*判别分析*/d

18、ataex18_4;inputx1-x4 g;cards;6.0 -11.5 19 90 1-11.0 -18.5 25 -36 390.2 -17.0 17 3 2-4.0 -15.0 13 54 10.0 -14.0 20 35 20.5 -11.5 19 37 3-10.0 -19.0 21 -42 30.0 -23.0 5 -35 120.0 -22.0 8 -20 3-100.0 -21.4 7 -15 1-100.0 -21.5 15 -40 213.0 -17.2 18 2 2-5.0 -18.5 15 18 110.0 -18.0 14 50 1-8.0 -14.0 16 56

19、 10.6 -13.0 26 21 3-40.0 -20.0 22 -50 3;procdiscrim;classg;varx1-x4;priorsprop;run;/*样品聚类*/dataex19_3;inputx1-x10;cards;46 25 5 2138 1.68 0.35 8.11 4 4 135 12 20 3510 2.76 1.43 6.84 3 3 152 25 20 2784 2.19 0.54 4.11 3 3 132 7 20 2451 1.93 0.47 11.45 9 6 138 22 0 3247 2.56 0.80 11.68 5 5 151 31 30 37

20、10 2.92 0.37 11.60 2 2 140 9 10 3194 2.51 0.40 11.40 5 5 134 17 20 4658 3.67 0.46 11.35 3 3 150 29 0 5019 3.95 0.47 13.45 10 8 142 20 20 7482 5.89 0.12 13.11 0 0 257 30 15 3800 2.99 0.19 10.76 2 2 136 15 20 2478 1.95 0.25 10.00 0 0 137 12 0 3827 3.01 0.82 10.50 4 4 152 32 0 2984 2.35 0.16 11.15 3 3

21、152 32 10 3749 2.95 0.72 11.45 11 10 142 27 30 4941 3.89 0.73 13.80 7 6 144 27 20 3948 3.11 0.33 13.65 16 14 140 21 5 3360 2.64 0.37 11.40 0 0 138 21 5 2936 2.31 0.69 11.40 1 1 144 27 20 6851 5.39 0.99 12.28 7 6 243 27 0 3926 3.09 0.47 11.95 0 0 126 10 3 4381 3.45 0.52 11.80 7 5 137 18 20 7142 5.62

22、0.85 11.81 5 5 228 9 20 2612 2.06 0.37 11.65 1 1 125 9 30 2638 2.08 0.78 12.25 1 1 134 14 20 4322 3.40 0.41 15.00 5 5 150 32 20 2862 2.25 0.69 8.80 2 2 1;procclustermethod=average;varx1-x10;run;proctree;run;/*指标聚类*/procvarclusdata=ex19_3;varx1-x10;run;/*主成分分析*/dataex20_1;inputx1-x4;cards;40 2.0 5 20

23、10 1.5 5 30120 3.0 13 50250 4.5 18 0120 3.5 9 5010 1.5 12 5040 1.0 19 40270 4.0 13 60280 3.5 11 60170 3.0 9 60180 3.5 14 40130 2.0 30 50220 1.5 17 20160 1.5 35 60220 2.5 14 30140 2.0 20 20220 2.0 14 1040 1.0 10 020 1.0 12 60120 2.0 20 0;procprincomp;varx1-x4;run;/*因子分析*/dataex20_2;inputx1-x9;cards;4

24、.34 389 99.06 1.23 25.46 93.15 3.56 97.51 61.663.45 271 88.28 0.85 23.55 94.31 2.44 97.94 73.334.38 385 103.97 1.21 26.54 92.53 4.02 98.48 76.794.18 377 99.48 1.19 26.89 93.86 2.92 99.41 63.164.32 378 102.01 1.19 27.63 93.18 1.99 99.71 80.004.13 349 97.55 1.10 27.34 90.63 4.38 99.03 63.164.57 361 91

25、.66 1.14 24.89 90.60 2.73 99.69 73.534.31 209 62.18 0.52 31.74 91.67 3.65 99.48 61.114.06 425 83.27 0.93 26.56 93.81 3.09 99.48 70.734.43 458 92.39 0.95 24.26 91.12 4.21 99.76 79.074.13 496 95.43 1.03 28.75 93.43 3.50 99.10 80.494.10 514 92.99 1.07 26.31 93.24 4.22 100.00 78.954.11 490 80.90 0.97 26

26、.90 93.68 4.97 99.77 80.533.53 344 79.66 0.68 31.87 94.77 3.59 100.00 81.974.16 508 90.98 1.01 29.43 95.75 2.77 98.72 62.864.17 545 92.98 1.08 26.92 94.89 3.14 99.41 82.354.16 507 95.10 1.01 25.82 94.41 2.80 99.35 60.614.86 540 93.17 1.07 27.59 93.47 2.77 99.80 70.215.06 552 84.38 1.10 27.56 95.15 3

27、.10 98.63 69.234.03 453 72.69 0.90 26.03 91.94 4.50 99.05 60.424.15 529 86.53 1.05 22.40 91.52 3.84 98.58 68.423.94 515 91.01 1.02 25.44 94.88 2.56 99.36 73.914.12 552 89.14 1.10 25.70 92.65 3.87 95.52 66.674.42 597 90.18 1.18 26.94 93.03 3.76 99.28 73.813.05 437 78.81 0.87 23.05 94.46 4.03 96.22 87

28、.103.94 477 87.34 0.95 26.78 91.78 4.57 94.28 87.344.14 638 88.57 1.27 26.53 95.16 1.67 94.50 91.673.87 583 89.82 1.16 22.66 93.43 3.55 94.49 89.074.08 552 90.19 1.10 22.53 90.36 3.47 97.88 87.144.14 551 90.81 1.09 23.06 91.65 2.47 97.72 87.134.04 574 81.36 1.14 26.65 93.74 1.61 98.20 93.023.93 515

29、76.87 1.02 23.88 93.82 3.09 95.46 88.373.90 555 80.58 1.10 23.08 94.38 2.06 96.82 91.793.62 554 87.21 1.10 22.50 92.43 3.22 97.16 87.773.75 586 90.31 1.12 23.73 92.47 2.07 97.74 93.893.77 627 86.47 1.24 23.22 91.17 3.40 98.98 89.80;procfactorn=4;run;procfactorn=4rotate=quartimax;run;dataex21_1;input

30、x1-x4 y1-y4;cards;1210 120.1 23.8 61.0 10.2 66.3 2.01 2.731210 120.7 23.4 59.8 11.3 67.6 1.92 2.711040 121.2 22.9 59.0 10.1 66.5 1.92 2.601620 121.5 24.6 59.5 9.5 67.8 1.95 2.641690 122.5 24.4 60.7 11.0 69.2 2.08 2.641150 122.7 27.2 64.5 10.5 69.1 2.19 2.841150 123.2 20.0 56.1 10.4 59.3 1.83 2.61146

31、0 123.3 24.9 58.4 10.5 69.0 2.01 2.721190 123.4 21.8 59.0 10.6 67.4 1.90 2.711840 123.9 23.5 60.2 9.6 67.1 2.00 2.841250 124.5 25.2 63.0 11.2 67.8 2.05 2.781480 124.8 22.3 58.1 10.7 67.9 2.05 2.731310 124.9 22.0 58.0 10.5 67.8 1.98 2.681660 125.3 24.7 60.0 10.8 69.3 1.95 2.801580 125.6 22.8 59.0 9.4

32、 69.1 2.00 2.651460 125.8 25.7 61.0 10.2 69.6 1.95 2.701240 126.0 30.2 68.0 9.2 67.1 2.14 2.881100 126.2 25.2 60.5 9.8 68.4 1.98 2.721250 126.8 23.6 58.5 10.2 67.5 1.94 2.741270 127.1 23.0 57.7 10.8 69.8 1.90 2.781300 127.6 24.3 59.0 10.3 67.9 1.93 2.841350 127.7 24.1 60.0 11.0 69.7 2.03 2.771250 12

33、8.3 21.6 55.5 10.4 68.5 1.83 2.701720 128.5 27.1 62.0 11.4 71.2 2.03 2.751480 128.5 22.6 57.4 10.0 67.3 2.04 2.831380 129.4 24.9 60.5 11.5 69.8 2.04 2.761170 129.0 26.7 63.7 9.6 67.4 2.13 2.981640 129.8 26.1 62.0 9.8 71.0 2.00 2.841640 131.6 28.7 62.8 9.7 70.7 1.89 2.891150 130.2 25.0 58.6 10.5 71.8

34、 1.96 2.781430 130.5 26.1 60.7 10.8 68.6 2.05 2.771150 130.6 23.4 54.4 11.8 69.2 1.96 2.781150 131.4 25.5 63.2 10.2 70.4 2.05 2.841320 131.6 25.6 58.9 10.9 70.2 2.06 2.861360 131.7 27.4 62.0 10.9 73.5 1.99 2.701460 132.0 26.3 61.5 11.1 71.2 2.17 2.131380 132.2 25.7 61.4 10.1 70.1 1.96 2.831300 132.5

35、 24.5 57.0 10.8 71.8 2.02 2.841220 132.7 27.0 61.3 10.1 72.2 2.08 2.801320 132.9 25.2 60.5 11.2 73.1 2.01 2.731910 133.1 30.1 67.0 9.0 87.1 2.15 2.971800 133.5 26.5 62.5 9.8 71.7 2.07 2.821560 133.6 24.8 58.5 10.3 72.2 1.93 2.791840 134.0 26.0 60.5 10.4 73.0 1.98 2.741470 134.3 28.2 62.0 11.3 87.2 2

36、.66 4.031590 134.4 25.5 60.7 9.6 69.9 1.99 2.811430 134.1 26.6 63.0 11.2 72.2 2.06 2.901760 134.6 32.5 66.0 9.9 87.4 2.61 2.981470 135.3 27.9 61.8 10.1 73.3 2.20 2.781580 135.6 28.1 65.8 9.8 73.1 2.05 2.891580 136.5 28.2 62.0 11.8 72.9 2.17 2.921840 137.1 27.6 62.8 9.5 72.4 2.11 2.911810 137.4 28.3 62.5 9.4 74.2 2.06 3.001850 138.1 29.5 62.4 9.7 72.3 2.12 4.022120 140.0 34.9

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论