資源描述:
《統(tǒng)計(jì)軟件SAS教程SAS練習(xí).doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、libnamedy'd:dzwj';datady.by_student;procprintdata=dy.c9501;bysex;/*分類*/run;procprint;run;(女性一欄無(wú)法輸出,并且滿足條件的男性沒(méi)有輸出來(lái))libnamedy'd:dzwj';datady.sum_bkmoney;procprintdata=dy.bkmoneynoobs;sumamount;/*sum函數(shù)求和*/run;libnamedy'd:dzwj';procsortdata=dy.c9501;byname;procsortdata=dy.bkmoney;byname
2、;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;procprint;run;(出現(xiàn)亂碼)libn
3、amedy'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;tableallsex,(mathchinese)*(meanstd);/*求所有的變量的
4、均值*/run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;table(sexall)*(NPCTN);/*頻數(shù)分布*/run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;table(sexall)*math*(meanstd);/*指
5、定變量math的均值和方差*/run;procprint;run;libnamedy'd:dzwj';datady.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;table(sexall),(mathchinese)*(meanstd);/*統(tǒng)計(jì)量加標(biāo)簽*/keylabelmean='平均值'std='標(biāo)準(zhǔn)差'all='總計(jì)';labelsex='性別'math='數(shù)學(xué)'chinese='語(yǔ)文';run;procprint;run;libnamedy'd:dzwj';datad
6、y.meanstd_c9501;proctabulatedata=dy.c9501bk;classsex;varmathchinese;table(sexall='總計(jì)'),(mathchinese)*(mean='平均值'std='標(biāo)準(zhǔn)差');/*統(tǒng)計(jì)量加標(biāo)簽,標(biāo)簽加在其中*/labelsex='性別'math='數(shù)學(xué)'chinese='語(yǔ)文';run;procprint;run;(結(jié)果如上圖所示)libnamedy'd:dzwj';datady.by_sex;procsortdata=dy.c9501;bysex;run;procprint;run;libna
7、medy'd:dzwj';datady.by_sex;procsortdata=dy.c9501;bysexdescendingmath;run;procprint;run;(矩陣的轉(zhuǎn)置沒(méi)有實(shí)現(xiàn),165頁(yè))libnamedy'd:dzwj';datady.means_c9501;procmeansdata=dy.c9501;/*描述性統(tǒng)計(jì)*/run;procprint;run;libnamedy'd:dzwj';datady.freq_c9501;procfreqdata=dy.c9501;/*求頻率和累計(jì)值*/tablessex;run;procprin