【正文】
選擇分析變量和統(tǒng)計量 沒有選擇分析變量時 , 缺省使用每個類的觀測頻數(shù)為輸出統(tǒng)計量 。 hbar city / mindpoint=’BJ’ ‘SH’ ‘GZ’。 vbar sales / 1000 to10000 by 1000。 與分類變量有關(guān)的選項說明: L E V E L = N 對數(shù)值型變量設(shè)定為 N 類M I N D P O I N T = 值列 對字符型變量依次列舉每個類的變量值,對數(shù)值型變量列舉每個分類的中點D I S C R E T E 對數(shù)值型變量設(shè)定每個值為一類A S C E N D I N G 按統(tǒng)計量的升序排列各個柱 ( 餅的角 )D E S C E N D I N G 按統(tǒng)計量的降序排列各個柱 ( 餅的角 )例 分類變量選項舉例 。 為了控制柱 (餅的角 )的排列順序和用數(shù)值變量分類時類的個數(shù) 。 分類變量確定類別的方法 分類變量類型 確定類別的缺省方法字符 變量的每個值是一個類別數(shù)值 將 分 類 變 量 的 變 化 范 圍 分 成 若 干 個 等 長 的 區(qū) 間 , 每 個 區(qū)間是一類,并在圖形中以區(qū)間的中點為該類的標(biāo)簽GCHART過程還提供不同的選項允許按不同的要求進行分類 。 過程 GCHART表現(xiàn)的是數(shù)據(jù)的匯總信息,即在某種分類下分析變量的某些統(tǒng)計量。 PIE | PIE3D | DONUT chartvariable(s) / option(s)。 BLOCK chartvariable(s) / option(s)。使用 GCHART過程可以制作二維或三維的柱狀圖和餅圖。 quit。 plot high*year low*year / overlay legend=legend1 vref=1000 to 5000 by 1000 lvref=2 haxis=axis1 hminor=4 vaxis=axis2 vminor=1。 legend1 label=none shape=symbol(4,2) position=(top center inside) mode=share。 /*接上頁 */ axis1 order=(1955 to 1995 by 5) offset=(2,2) label=none major=(height=2) minor=(height=1) width=3。 symbol1 color=red interpol=join value=dot height=3。 j=r 39。 footnote1 h=3 j=l 39。 title1 39。 例 疊加圖形 。 run。 bubble dollars*eng=num / haxis=axis1 vaxis=10000 to 40000 by 10000 hminor=0 vminor=1 blabel bfont=swissi bcolor=red bsize=12 caxis=blue。 /*接上頁 */ proc gplot data=。GR21N03 39。Salaries and Number of Member Engineers39。Member Profile39。 run。 set 。 goptions reset=global gunit=pct border cback=white colors=(black blue green red) ftitle=swissb ftext=swiss htitle=6 htext=3。 quit。 bubble dollars*eng=num / haxis=axis1 vaxis=axis2 vminor=1 bcolor=red blabel bfont=swissi bsize=12 caxis=blue。 /*接上頁 */ proc gplot data=。 axis1 label=none offset=(5,5) width=3 value=(height=4)。 footnote1 h=3 j=r 39。 title2 h=4 39。 title1 39。 例 規(guī)定泡沫的大小和標(biāo)簽 。 run。 format dollars dollar9.。 axis1 offset=(5,5)。 footnote h=3 j=r 39。 title2 39。 title1 39。 0 水平, 90 豎直O(jiān) R D E R = 規(guī)定坐標(biāo)軸上大刻度的范圍和順序R= 規(guī)定 S Y M B O L 語句重復(fù)的次數(shù)應(yīng)用舉例 例 創(chuàng)建簡單泡沫 ( Bubble) 圖 。 選項說明: V= 規(guī)定數(shù)據(jù)點的圖形符號H= 規(guī)定圖形符號的高度I= 規(guī)定兩點之間的插值方法F O N T = 規(guī)定字體L= 規(guī)定點之間插值線的類型C O L O R = 規(guī)定圖形線的顏色AXIS語句 AXIS語句規(guī)定圖形的軸的表現(xiàn)形式 。 PLOT語句 PLOT語句規(guī)定橫軸變量 (行在前面 )和豎軸變量 (列在后面 )。 PLOT plotrequest(s) /option(s)。 BUBBLE plotrequest(s) /option(s)。 作圖過程 GPLOT輸出高精度散點圖及連線圖 。 SAS/GRAPH軟件可以展現(xiàn)圖形有: ? 散點圖及連線圖 (PLOTS); ? 圖表 (CHARTS); ? 地圖 (MAPS); ? 三維圖 (3D GRAPHICS); ? 幻燈片 (TEXT SLIDES)等 。 作圖過程 圖形是展現(xiàn)數(shù)據(jù)的重要方法 , 圖形的形象直觀是數(shù)據(jù)報表無法替代的 。 ods html close。(millions of dollars)39。Energy Expenditures39。 format region regfmt. division divfmt. type usetype.。 keylabel all=Total。 var expenditures / style=[font_size=3]。 class region division type / style=[just=center]。d:\ResDat\39。 例 輸出為 HTML格式的報表 。*(sum colpctsum*f=pctfmt9. rowpctsum*f=pctfmt9. reppctsum*f=pctfmt9.) all /rts=20 row=float。, classrm=39。 table (team all)*sales=39。 class team classrm。 title Fundraiser Sales。009 %39。 proc format。 例 計算百分比統(tǒng)計量 。(millions of dollars)39。Energy Expenditures for Each Region and All Regions39。 format region regfmt. division divfmt. type usetype.。 39。 39。Customer Base39。All Divisions39。All Regions39。Region: 39。 var expenditures。 proc tabulate data= format=dollar12.。 例 創(chuàng)建多頁報表。(millions of dollars)39。Energy Expenditures for Each Region39。 format region regfmt. division divfmt. type usetype.。 39。 39。Customer Base39。 var expenditures。 proc tabulate data= format=dollar12.。 例 定制行列標(biāo)題 。(millions of dollars)39。Energy Expenditures for Each Region39。 format region regfmt. division divfmt. type usetype.。 var expenditures。 proc tabulate data= format=dollar12. classdata= exclusive。 例 規(guī)定 CLASS變量組合出現(xiàn)在報表中 。(millions of dollars)39。Energy Expenditures for Each Region39。 format region regfmt. division divfmt. type usetype.。 var expenditures。 proc tabulate data= format=dollar12.。 run。 2=39。 value usetype 1=39。 4=39。 3=39。 2=39。 value divfmt 1=39。 4=39。 3=39。 2=39。 value regfmt 1=39。 應(yīng)用舉例 例 。 ? TABLE語句的選項非常復(fù)雜,使用時可查看 SAS系統(tǒng)的幫助。 ? 和 PRINT過程不同 , TABULATE過程沒有一個缺省的報表格式 , 所有由 TABULATE過程輸出報表時 , 必須先對報表的進行布局設(shè)計 。 WEIGHT variable。 TABLE pageexpression, rowexpression, columnexpression / tableoption(s)。descriptionn39。description139。 FREQ variable。 CLASS variable(s) / options。 制表過程句法 PROC TABULATE option(s)。 制表過程 ? 利用 TABULATE過程可以制作匯總報表展現(xiàn)數(shù)據(jù) 。Salaries for Flight Attendants and Mechanics39。Expenses Incurred for39。ME39。FA39。 format salary 。 salary=39。 gender=39。 label jobcode=39。 var gender salary。 id jobcode。 proc print data=tempemp split=39。 by jobcode gender。 options nodate pageno=1 linesize=64 pagesize=60。 options byline。Revenue and Expense Totals for the byval(region) Region39。 format revenues expenses ma10.。 sum expenses revenues。 proc print data= noobs n=39。 by region。 options nodate pageno=1 linesize=70 pagesize=60 nobyline。 run。 title 39。Sales Region39。 pageby region。 var month expenses revenues。Number of observations for the state: 39。