SGplot画图样例

*Grouping a Scatter Plot;
proc sgplot data=sashelp.class;
  scatter x=height y=weight / group=sex;
run;

*Plotting Three Series;
proc sgplot data=sashelp.stocks
  (where=(date >= "01jan2000"d and stock = "IBM"));
  title "Stock Trend";
  series x=date y=close;
  series x=date y=low;
  series x=date y=high;
run;

*Adding Prediction and Confidence Bands to a Regression Plot; 
proc sgplot data=sashelp.class;
  reg x=height y=weight / CLM CLI;
run;

*Adding a Prediction Ellipse to a Scatter Plot;
proc sgplot data=sashelp.iris;
  title "Iris Petal Dimensions";
  scatter x=petallength y=petalwidth;
  ellipse x=petallength y=petalwidth;
  keylegend / location=inside position=bottomright;
run;

*Creating Lines and Bands from Pre-Computed Data;
proc sgplot data=sashelp.classfit;
  title "Fit and Confidence Band from Precomputed Data";
  band x=height lower=lower upper=upper /
       legendlabel="95% CLI" name="band1";
  band x=height lower=lowermean upper=uppermean /
       fillattrs=GraphConfidence2
       legendlabel="95% CLM" name="band2";
  scatter x=height y=weight;
  series x=height y=predict / lineattrs=GraphPrediction
         legendlabel="Predicted Fit" name="series";
  keylegend "series" "band1" "band2" / location=inside position=bottomright;
run;
 
*Adding Statistical Limits to a Dot Plot;
proc sgplot data=sashelp.class(where=(age<16));
  dot age / response=height stat=mean
            limitstat=stddev numstd=1;
run;

*Combining Histograms with Density Plots;
proc sgplot data=sashelp.heart;
  title "Cholesterol Distribution";
  histogram cholesterol;
  density cholesterol;
  density cholesterol / type=kernel;
  keylegend / location=inside position=topright;
run;
 
*Creating a Horizontal Box Plot;
proc sgplot data=sashelp.heart;
  title "Cholesterol Distribution by Weight Class";
  hbox cholesterol / category=weight_status;
run;

*Creating a Bar-Line Chart;
proc sgplot data=sashelp.stocks (where=(date >= "01jan2000"d
                                 and date <= "01jan2001"d
                                 and stock = "IBM"));
   title "Stock Volume vs. Close";
   vbar date / response=volume;
   vline date / response=close y2axis;
run;


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值