sas数据集例题.docx
- 文档编号:4562839
- 上传时间:2022-12-06
- 格式:DOCX
- 页数:9
- 大小:189.31KB
sas数据集例题.docx
《sas数据集例题.docx》由会员分享,可在线阅读,更多相关《sas数据集例题.docx(9页珍藏版)》请在冰豆网上搜索。
sas数据集例题
sas数据集例题
LT
结果分析
一、
(1)
dataclass;
inputidbiochemistry$physicalpathology;
labelid='学号'biochemistry='生化'physical='物理'pathology='病理';
cards;
083687165
084746168
085737546
087757168
084858587
085787975
086807679
089677371
118705475
083706684
084627365
099827079
;
run;
procprintdata=classlabel;
run;
(2)
(3)
dataclass;
inputidbiochemistry$physical$pathology$ave$@@;
labelid='学号'biochemistry='生化'physical='物理'pathology='病理';
ave=mean(biochemistry,physical,pathology);
ifave<60thenave='E';
if60<=ave<70thenave='D';
if70<=ave<=79thenave='C';
if80<=ave<=89thenave='B';
if90<=ave<=100thenave='A';
return;
cards;
083687165
084746168
085737546
087757168
084858587
085787975
086807679
089677371
118705475
083706684
084627365
099827079
;
procprint;
run;
二.
6.
libnamesas7bdat'c:
\saslx';
datastudent;
infile'c:
\sasdt\student.txt';
lengthid$18;
lengthname$16;
inputid$name$Englishconputer;
age=2015-input(substr(id,7,4),4.);
ifmod(substr(compress(id),17,1),2)
thensex='1';
elsesex='2';
dropid;
run;
datasas7bdat.mstu;
setstudent;
ifsex=1;
keepnameagesexEnglishcomputer;
datasas7bdat.fstu;
setstudent;
ifsex=2;
keepnameagesexEnglishcomputer;
run;
procprint;
run;
7.
libnamesas7bdat'c:
\saslx';
datastudent;
infile'c:
\sasdt\student.txt';
lengthid$18;
lengthname$16;
inputid$name$Englishconputer;
age=2015-input(substr(id,7,4),4.);
ifmod(substr(compress(id),17,1),2)
thensex='1';
elsesex='2';
dropid;
run;
datasas7bdat.stu90;
setstudent;
whereEnglish>90andconputer>90;
run;
procprint;
run;
三.
首先导入数据集
dataliangbiao;
MERGED1D2;
datalb;
setliangbiaoD3;
procexportdata=lboutfile="d:
\cym\SAS作业\量表.sav"
REPLACE;
datalb;
arraylb[72]a1-a50b1-b22;
setlb;
lb
(1)=6-lb
(1);lb(5)=6-lb(5);lb(30)=6-lb(30);lb(43)=6-lb(43);
lb(49)=6-lb(49);lb(52)=6-lb(52);lb(56)=6-lb(56);lb(69)=6-lb(69);
sum1=sum(ofa1-a25);
sum2=sum(ofa26-a50);
sum3=sum(ofb1-b22);
datalb;
setlb;
procstandarddata=lbout=lbreplace;
varsum1sum2sum3;
run;
procsortdata=lb;
bysum3;
datacheng;
inputgroup@@;
datalines;
11111111112222222222222222222222222222222222222222222223333333333
run;
datalg;
MERGElbcheng;
run;
datalg;
setlg;
if(group=1)thensum='高分组';
if(group=2)thensum='中间组';
if(group=3)thensum='低分组';
run;
结果如下:
成绩
教师签名
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- sas 数据 例题
![提示](https://static.bdocx.com/images/bang_tan.gif)