【正文】
ing Statistics39。 title2 39。 by section。 types () status*year。 proc means data= n mean max min range std fw=8。 by date。 ID語句 ID variablelist。 FREQ語句 FREQ variable。缺省時指輸入數據集中除 BY、 CLASS、 ID、 FREQ和 WEIGHT語句中列出的變量之外所有數值變量。 TYPES request(s)。 run。 title 39。 proc freq data= order=data。 weight count。 run。沒有 TABLES語句 39。 data a。當使用 BY語句時,要求輸入數據集已按 BY變量排序的次序排列,除非指定 NOTSORTED。 run。male 39。 表格沒有輪廓線和分隔線的 FORMCHAR=選項: FORMCHAR(1,2,7)= 39。 EXACT statistickeywords。從含有缺失值的數據集中計算 CSSCP和 COV39。 proc corr data=a nomiss cov。PROC CORR產生的輸出數據集 39。 run。 title 39。 title 39。該變量的值應為正整數。 PARTIAL語句 PARTIAL variablelist。 WITH variable(s)。第 16章 統(tǒng)計量計算 清華大學經管學院 朱世武 本章將介紹的統(tǒng)計量計算過程包括: ? 相關過程; ? 頻數過程; ? 均值過程; ? 單變量過程。 WEIGHT weightvariable。用VAR語句列出的變量放在相關陣的上方,而用 WITH語句列出的變量放在相關陣左邊。 該語句指定一個數值型的 FREQ變量,它的值表示輸入數據集中相應觀測出現(xiàn)的頻數。 var weight oxygen runtime。 var oppr hipr lopr clpr。偏相關陣 39。 title2 39。 run。 title2 39。 WEIGHT variable。| +39。 = 39。 format sex $sfmt.。 對 BY變量定義的觀測組分別計算其相應的簡單統(tǒng)計量。 應用舉例 例 隨機數頻數分析 。 title 39。 tables x*y/list。 proc freq data= order=data。 options nodate pageno=1 pagesize=60。 proc print data=chisqdat noobs。 table _col3*_col4 _col4*_col5 /nocol norow nopercent 。 OUTPUT OUT=SASdataset outputstatisticspecification(s) idgroupspecification(s) maximumidspecification(s) minimumidspecification(s) / option(s) 。 其它語句 VAR語句 VAR variablelist 規(guī)定要求計算簡單描述統(tǒng)計量的數值變量及次序。CLASS語句和 BY語句可以一起使用。當這個值 0或缺失時,假定該值為 0。 proc sort data=。 options nodate pageno=1 linesize=80 pagesize=60。 class Status Year。 proc sort data= out=GradeBySection。Final Exam Scores for Student Status and Year of Graduation39。 title 39。 class Status Year。For Two Years39。 title 39。 單變量過程句法 PROC UNIVARIATE option(s)。)。 VAR variable(s)。當使用 BY語句時,要求輸入數據集已按 BY變量排序的次序排列,除非指定NOTSORTED。若這個值 0或缺失,假定該值為 0。 statistickeywordlist選項就是單變量過程 UNIVARIATE可以計算的描述統(tǒng)計量 。United States Census of Population and Housing39。United States Census of Population and Housing39。 proc print data=teststat noobs。 goptions htitle=4 htext=3 ftext=swissb ftitle=swissb。 normal_x=10*rannor(53124)+50。 title 39。 run。 SUMBY BYvariable。 run。 run。 options nodate pageno=1 linesize=70 pagesize=60。 proc print data= split=39。State**=====39。 options pagesize=60 pageno=1 nodate linesize=70。 by region state。 例 對 BY組中的數值變量求和 。 by region。 proc sort data= out=tempemp。 sum salary。 where jobcode contains 39。 run。 KEYLABEL keyword1=39。 語句說明: BY 規(guī)定分別按 BY 組制表C L A S S 規(guī)定分類變量C L A S S L E V 規(guī)定分類變量級別標題的格式F R E Q 規(guī)定一個數值變量 , 其值為每一觀測值出現(xiàn)的頻數K E Y L A B E L 規(guī)定關鍵詞的標簽K E Y W O R D 規(guī)定關鍵詞標題的格式T A B L E 規(guī)定要產生表格的布局VAR 規(guī)定分析變量W E I G H T 規(guī)定權數變量,其值為一觀測的權數TABLE語句 TABLE pageexpression, rowexpression, columnexpression / tableoption(s)。Northeast39。New England39。Residential Customers39。 table region*division, type*expenditures / rts=25。 options nodate pageno=1 linesize=80 pagesize=60。 title2 39。 table region*division, type=39。 title 39。 class region division type。, type=39。 title 39。 picture pctfmt lowhigh=39。 39。 proc tabulate data= style=[font_weight=bold]。 title 39。 SAS/GRAPH軟件具有強大的作圖功能 。 PLOT2 plotrequest(s) /option(s)。Member Profile39。 bubble dollars*eng=num / haxis=axis1。Salaries and Number of Member Engineers39。 run。 title1 39。 format dollars dollar7. num yen 。Dow Jones Yearly Highs and Lows39。 axis2 order=(0 to 6000 by 1000) offset=(0,0) label=none major=(height=2) minor=(height=1) width=3。 圖表過程句法 PROC GCHARTDATA=inputdatasetANNOTATE=Annotatedataset GOUT=libref.outputcatalog IMAGEMAP=outputdataset。 GCHART過程不提供分析變量時 , 作圖時使用的缺省統(tǒng)計量是頻數 , 指明分析變量時使用的缺省統(tǒng)計量是總和 。 hbar city / ascending。 vbar sales / levels=10。 STAR chartvariable(s) / option(s)。 run。GR21N06 39。 quit。 footnote j=r 39。 data 。 axis2 order=(0 to 40000 by 10000) label=none major=(height=) minor=(height=1) width=3 value=(height=4)。 goptions reset=global gunit=pct border cback=white colors=(black blue green red) ftitle=swissb ftext=swiss htitle=6 htext=4。GR21N01 39。 選項說明: L A B E L = 給軸加標簽A N G L E = 規(guī)定軸標簽的角度。 作圖過程句法 PROC GPLOT DATA=inputdataset ANNOTATE=Annotatedataset GOUT=libref.outputcatalog IMAGEMAP=outputdataset UNIFORM。 run。 keyword all sum / style=[font_width=wide]。 run。 proc tabulate data=ResDat. Fundrais format=7.。 run。*sum=39。 all=39。 run。*sum=39。 options nodate pageno=1 linesize=80 pagesize=60。 table region*division, type*expenditures / rts=25。 title2 39。 options nodate pageno=1 linesize=80 pagesize=60。Mountain39。Midwest39。這里我們通過例子來說明一些選項的使用方法 。 KEYWORD keyword(s) / style =styleelementname | PARENT [styleattributespecification(s)]。 BY DESCENDING variable1 ...DESCENDING variablen NOTSORTED。 title 39。Gender*======39。*39。 run。 run。 format revenues expenses ma10.。 proc print data= n=39。 title 39。 var month state expenses。Monthly Expenses for Offices in Each State39。身高體重 39。39。 語句說明: BY 規(guī)定分別按 BY 組打印列表ID 規(guī)定用來代替觀測序號的變量置于輸出的最左列P A G E B Y 規(guī)定在新的一頁上輸出S U M B Y 規(guī)定按 BY 組計算總和S U M 規(guī)定計算數值變量的總和VAR 規(guī)定要輸出的變量及順序PROC PRINT語句 PROC PRINT option(s)。 ? PRINT過程是展現(xiàn)數據集內容的最簡單過程。 var Exponential_x。 run。Normal Random Variable39。Output Data Set from PROC UNIVARIATE39。 proc univariate data= noprint。 proc univariate data= freq round=1 nextrobs=2 nextrval=4。 options nodate p