- Proc GCHART DATA==SAS--data--set;
- HBAR chart-variable . . . </options>;/*水平柱状图*/
- VBAR chart-variable . . . </options>;
- /*垂直柱状图*/
- PIE chart-variable . . . </options>;
- 简单的例子如下:
- proc gchart data=ia.crew;
vbar JobCode;
/*JobCode为分类变量*/
run;
- 上面的例子柱形图默认统计的是分类变量JobCode的频数,那么如果想实现分类求和或者分类求平均则要用到下面的例子
- SUMVAR=analysisvariable
TYPE=MEAN | SUM
- goptions reset=all;/*格式设置*/
title1 h=2 c=blue f=swissb "Production Quality";
title2 h=2 c=blue f=swissb "January through June";
footnote1 h=2 c=green f=swiss "Data from SASDATA.QUALITY";
footnote2 h=2 c=green f=swiss "* denotes approximations";
data totals;/*数据*/
length dept 7site 7 site 8;
input dept site quarter sales;
datalines;
Parts Sydney 1 7043.97
Parts Atlanta 1 8225.26
Parts Paris 1 5543.97
Tools Sydney 4 1775.74
Tools Atlanta 4 3424.19
Tools Paris 4 6914.25;
proc gchart data=totals;/*画图*/
format sales dollar8.;
vbar site / sumvar=sales type=sum;
run;
quit; -
柱状图跟饼图
最新推荐文章于 2022-09-19 11:20:46 发布