SAS医学统计分析实验材料
实验二
2.4
在计算机最后一个硬盘的根目录下建data class1;
立文件夹sas。下面的程序假设在e:盘根目input num class e m p; 录下建立了文件夹sas cards;
2.1
101 1 69 69 58 libname L1 ‘e:\sas’; 102 1 92 87 85 data L1.d1;
103 1 97 87 86 input num name$ sex$ age m e c ; 104 1 85 85 72 cards;
;
101 liuming m 28 76 65 70 data class2;
102 zhaolei m 32 74 70 67 input num class e m p; 103 linli f 41 82 85 82 cards;
104 qifang f 27 65 62 69 105 2 92 97 90 105 wanghui f 43 67 60 65 106 2 99 99 100 ;
107 2 62 57 60 proc print label;
108 2 75 85 72 label m=’math’ e=’english’ c=’computer’; ;
run; data class12; set class1 class2; 2.2
total=e+m+p; libname L1 ‘e:\sas’; proc print; data L1.e1; proc sort;
set L1.d1; by descending class descending tot=m+e+c; proc print; drop m e c; run; proc print; run; 2.5 data d1;
2.3
input name $ sex $ e m; libname L1 ‘e:\sas’; cards;
data L1.abc;
zhang m 92 85 set L1.a; (注:将P188程序改动,事先建立li f 91 67 永久数据集a) wang m 90 75 proc sort; sun f 92 85 by e;
;
proc print ; data d2;
proc sort;
input name $ p ph; by descending p; cards;
proc print ; li 87 85 run; zhang 85 67 sun 67 90 wang 82 85
lu 90 85
1
total;
;
proc sort data=d1; by name;
proc sort data=d2; by name; data d12;
merge d1 d2; by name; proc print ; proc sort; by sex; proc print; run;
实验三
先在E盘上SAS子目录下建立 TEXT1.TXT文件 内容如下:
101 zhangke m 1.75 65 102 zhaoming m 1.74 70 103 liming m 1.82 85 104 lianghui f 1.65 60 105 baoqi f 1.59 50 106 liangmin m 1.80 81 3.1
libname aa 'e:\sas'; data aa.sy31;
infile 'e:\sas\text1.txt';
input num name $ sex$ h w ; proc sort; by sex; proc print; by sex;
proc means; class sex; var w; proc print; format h 4.1;
title 'title exercise'; footnote 'end exercise'; run;
3.2
libname aa 'e:\sas'; data aa.sy32;
input name $ sex group t1 t2 t3 ; tot=sum(of t1-t3); cards;
libin 1 1 65 60 54 wuyan 1 2 80 90 65 wuming 2 2 65 65 65 luke 1 3 66 72 77 wangkai 2 3 81 82 89 lubin 2 2 70 59 84 liangke 2 1 93 90 82 sunling 2 3 85 97 81 ;
proc format;
value sexfmt 1='male' 2='female'; proc print;
format sex sexfmt.; proc sort; by group; proc print ; by group; proc format;
value totfmt low-180='C' 180<-240='B' 340<-high='A'; proc print;
format sex sexfmt. tot totfmt.; proc sort;
by descending tot; proc print; proc sort;
by descending group tot; proc print; run;
2008年3月3日
2
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库sas实验程序在线全文阅读。
相关推荐: