/* This step is used to ensure that the graphs from the next  */
   /* execution of the code generates the only graphs that       */
   /* reside in the catalog to be used.                          */
proc greplay nofs igout=work.gseg;
   delete _all_; 
run; 
quit;

   /* set GOPTION NODISPLAY so graphs initially generated are    */
   /* not displayed                                              */
goptions nodisplay;

   /* The following three blocks of code generate the data to be */
   /* used, create the graphs to be used, and place them in a    */
   /* catalog. In this case the graphs are stored in work.gseg.  */
data sales;
   input qrt region $ sales;
   cards;
1 north 12879
2 north 34987
3 north 18987
4 north 35877
1 south 11879
2 south 43267
3 south 34756
4 south 25435
1 east  09876
2 east  12987
3 east  34766
4 east  45867
1 west  44765
2 west  65498
3 west  23455
4 west  34567
;
run;

   /* use PROC SORT to sort data by region                       */
proc sort data=sales out=sales;
   by region;
run;

title 'Quarterly Sales by Region';

   /* generate the graphs                                        */
proc gchart gout=work.gseg;
   by region;
   vbar qrt / sumvar=sales discrete;
run;
quit;

title;  /* reset TITLE statement                                 */