欢迎来到天天文库
浏览记录
ID:39410784
大小:381.00 KB
页数:17页
时间:2019-07-02
《统计软件SAS教程 SAS练习》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、libnamedy'd:dzwj';datady.by_student;procprintdata=dy.c9501;bysex;/*分类*/run;procprint;run;(女性一栏无法输出,并且满足条件的男性没有输出来)libnamedy'd:dzwj';datady.sum_bkmoney;procprintdata=dy.bkmoneynoobs;sumamount;/*sum函数求和*/run;libnamedy'd:dzwj';procsortdata=dy.c9501;byname;procsortdata=dy.bk
2、money;byname;datady.c9501bk;mergedy.c9501dy.bkmoney;/*merge横向合并*/byname;run;procsortdata=dy.c9501bk;bysex;procprintdata=dy.c9501bk;bysex;sumamount;run;libnamedy'd:dzwj';datady.table_c9501bk;proctabulatedata=dy.c9501bk;/*tabulate分类汇总*/classsex;varamount;tablesex,amount;run;
3、procprint;run;(出现乱码)libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;tablesex,(mathchinese)*(meanstd);/*求变量的均值*/run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;tablealls
4、ex,(mathchinese)*(meanstd);/*求所有的变量的均值*/run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;table(sexall)*(NPCTN);/*频数分布*/run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex
5、;varmathchinese;table(sexall)*math*(meanstd);/*指定变量math的均值和方差*/run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;table(sexall),(mathchinese)*(meanstd);/*统计量加标签*/keylabelmean='平均值'std='标准差'all='总计';labelsex='性别'math
6、='数学'chinese='语文';run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;table(sexall='总计'),(mathchinese)*(mean='平均值'std='标准差');/*统计量加标签,标签加在其中*/labelsex='性别'math='数学'chinese='语文';run;procprint;run;(结果如上图所示)libnamedy'd:
7、dzwj';datady.by_sex;procsortdata=dy.c9501;bysex;run;procprint;run;libnamedy'd:dzwj';datady.by_sex;procsortdata=dy.c9501;bysexdescendingmath;run;procprint;run;(矩阵的转置没有实现,165页)libnamedy'd:dzwj';datady.means_c9501;procmeansdata=dy.c9501;/*描述性统计*/run;procprint;run;libnamedy'
8、d:dzwj';datady.freq_c9501;procfreqdata=dy.c9501;/*求频率和累计值*/tablessex;run;procprin
此文档下载收益归作者所有