Sample 24864: Overlay a vertical bar chart with a plot line and a right vertical axis
/**************************************************************************/
/* This example creates a bar chart and a plot and uses GREPLAY to replay */
/* them on top of one another. */
/**************************************************************************/
goptions reset=all;
/* Clear all graphs from the WORK.GSEG catalog */
proc greplay igout=work.gseg nofs; delete _all_; run;
/* Create the input data set, SALES */
data sales;
input quarter $ 1-1 sales 3-5;
datalines;
1 400
2 600
3 750
4 900
;
/* Assign axis definitions */
axis1 order=(0 to 1000 by 100) origin=(20,20)pct length=40 pct;
axis2 origin=(20,20)pct length=20 pct;
/* Assign pattern characteristics */
pattern1 value=solid color=blue;
/* Produce the Vertical Bar Chart */
proc gchart data=sales gout=work.gseg;
vbar quarter / sumvar=sales raxis=axis1 space=1 maxis=axis2;
run;
quit;
goptions reset=all;
/* Create the input data set, EARNINGS */
data earnings;
input quarter earnings;
datalines;
1 10
2 17
3 25
4 32
;
/* Assign axis definitions */
axis1 order=(0 to 40 by 10) value=none origin=(20,20) pct length=40 pct
label=none major=none minor=none ;
axis2 order=(1 to 4 by 1) value=none origin=(20,20) pct length=20 pct
label=none major=none minor=none offset=(3,3) pct;
axis3 order=(0 to 40 by 10) origin=(40,20) pct length=40 pct;
/* Assign symbol characteristics */
symbol1 i=j v=dot c=red w=2;
symbol2 i=j v=dot c=red w=2;
/* Add titles and footnotes */
footnote1 c=blue move=(25,7)pct f=marker 'U' f=none c=black ' SALES';
footnote2 c=red move=(25,4)pct f=swissb '______' c=black font=none ' EARNINGS';
/* Produce the plot */
proc gplot gout=work.gseg data=earnings;
plot earnings * quarter / vaxis=axis1 haxis=axis2;
plot2 earnings * quarter / vaxis=axis3 haxis=axis2;
run;
/* Use PROC GREPLAY to overlay the chart and the plot */
proc greplay igout=work.gseg nofs tc=sashelp.templt template=whole;
treplay 1:gchart
1:gplot;
run;
quit;
This example creates a bar chart and a plot and uses GREPLAY to replay them on top of one another.
| Type: | Sample |
| Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Bar SAS Reference ==> Procedures ==> GCHART
|
| Date Modified: | 2005-08-24 16:06:24 |
| Date Created: | 2004-11-11 11:07:52 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | n/a | n/a |