資源描述:
《sas基本統(tǒng)計(jì)情況文本筆記》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、\Range極差mean(1,2,3)平均std標(biāo)準(zhǔn)差/**自動(dòng)導(dǎo)入**/Libnamecwb“”;procimportdatafile="E:WORK雜七雜八SAS數(shù)據(jù)庫(kù)分期樂(lè)入池?cái)?shù)據(jù)明細(xì)數(shù)據(jù)(風(fēng)險(xiǎn)指標(biāo)監(jiān)控表&實(shí)際還款表)荷包一期_風(fēng)險(xiǎn)指標(biāo)監(jiān)控表詳細(xì)總表&today_date..xls"out=work.risk001dbms=excelreplace;sheet='風(fēng)險(xiǎn)指標(biāo)監(jiān)控表總表';getnames=yes;導(dǎo)入源文件字段名作為SAS數(shù)據(jù)集的字段名自動(dòng)導(dǎo)入%macrochouc(today_dat
2、e);datafile="C:Users抽查一債權(quán)基礎(chǔ)池報(bào)表&today_date..xls"out=work.chouc01dbms=excelreplace;sheet="債權(quán)基礎(chǔ)池";run;%mend;%chouc(20170116);導(dǎo)出:procexportdata=sashelp.carsoutfile='/folders/myfolders/sasuser.v94/TutorialsPoint/car_data.csv'dbms=csv;run;\/4*先排序*/procsortdata=new
3、_cy2;by_COL1;run;/***標(biāo)題**打印*/procprint;title'員工薪水';RUN;procprintdata=cwb.result20170208label;idpackage;varoverdue_principal_zaoverdue_principal_fql;labeloverdue_principal_za="違法停車(chē)"overdue_principal_fql="林肯";run;procprintdata=cwb.result20170208;whereprincipal_sel
4、l>20000000;run;/*統(tǒng)計(jì)表格*/1proctabulatedata=work.risk005b;class_COL22;分類(lèi)變量var_COL5;分析變量table_COL22_COL5;列維說(shuō)明/選項(xiàng)(mathchinese)*(meanvar)反映男女生數(shù)學(xué)語(yǔ)文成績(jī)的平均值方差run;2proctabulatedata=work.risk005b;\class_COL22;var_COL5_COL4;table_COL22,(_COL4_COL5)*(meanmaxmin);run;table_
5、COL22all,(_COL4_COL5)*(meanmaxmin);加個(gè)ALL,有求和,圖2.也可寫(xiě)為例如table(_COL22all)*(_COL4)*(mean);如圖也可加標(biāo)簽table(sexall),(mathchinese)*(meanstd);
keylabelmean='平均值'std='標(biāo)準(zhǔn)差'all='總計(jì)';
labelsex='性別'math='數(shù)學(xué)'chinese='語(yǔ)文';
run;
----------------------------------------------------
6、-----------------/**復(fù)制*強(qiáng)制追加*把B加到A中*而SET是要新建一個(gè)的*/procappendbase=chouc.chouc01data=chouc.chouc02force;/**force強(qiáng)制*/run;/**復(fù)制*強(qiáng)制追加*把B加到A中*而SET是要新建一個(gè)的*/procsortdata=chouc.chouc01dupout=chouc.bbnoduprecs;/**noduprecs一行完全相同的重復(fù)記錄*/\bydescending_COL0;run;---------------
7、------------------------------------------------------/**sql*聯(lián)合查詢(xún)**/Procsql;Select*fromaUnion/*多個(gè)查詢(xún)結(jié)果合并成一個(gè)結(jié)果,并去掉重復(fù)**/Intersect/*查詢(xún)公共部分?jǐn)?shù)據(jù)*/Except/*把公共部分去掉的數(shù)據(jù)*/Outerunion/*對(duì)多個(gè)查詢(xún)結(jié)果橫向合并*/Select*fromb;Quit;-------------------------------------------------------------
8、--------/**去**重復(fù)**方法之一***/只顯示nameselectnamefromtbgroupbynamehavingcount(*)>1顯示所有數(shù)據(jù)select*fromnamein(selectnamefromtbgroupbynamehavingcount(*)>1)*2、輸出重復(fù)的觀測(cè)值,使用nodupkey