/**********************************************************************/


goptions device=vt330 border ftext=swiss;
title 'Sales by Region';                 

data newsales;                           
   input region sales;                   
   cards;                                
   1 100                                 
   2 120                                 
   3 150                                 
   4 110                                 
   5 120                                 
   ;                                     

   /* Display vertical bar chart on terminal screen.         */   
proc gchart data=newsales;                              
   vbar region/sumvar=sales discrete patternid=midpoint;
run;                                                    

   /* Rerun PROC GCHART to send output to printer.           */   
goptions device=qms800;                                 

proc gchart;                                            
   vbar region/sumvar=sales discrete patternid=midpoint;
run; 


/**********************************************************************/


goptions device=vt330 targetdevice=qms800;              

proc gchart data=newsales;                              
   vbar region/sumvar=sales discrete patternid=midpoint;
run;                                                    
quit;


/**********************************************************************/


   /* Set targetdevice to PSCOLOR and display                */           
   /* graph on Tektronix terminal.                           */           
goptions dev=tek4105 gprotocol=gsas7171                 
         targetdevice=pscolor;                           

proc gchart data=newsales;                              
   vbar region/sumvar=sales discrete patternid=midpoint;
run;                                                    
quit;                                                    

   /* Set GOPTIONS to produce hard copy                      */           
   /* output to be written to fileref GSASFILE.              */
filename gsasfile 'psoutput gsf a';                      

goptions dev=pscolor gaccess=gsasfile gprotocol=' ';     

   /* Replay graph created above by PROC GCHART.             */         
proc greplay nofs igout=gseg;                            
   replay _last_;                                        
quit;                                                    


/**********************************************************************/


   /* Set NODISPLAY to create graph using HPLJ300 driver,    */
   /* but not send it to printer. Also set CBACK=WHITE       */
   /* to simulate white paper when graph displayed on screen */
goptions nodisplay dev=hplj300 cback=white;                 

   /* run PROC GCHART to create catalog entry                */
proc gchart data=newsales;                                  
   vbar region/sumvar=sales discrete patternid=midpoint;    
run;                                                        
quit;                                                       

   /* set DISPLAY and DEV=VGA to preview graph               */
   /* with PROC GREPLAY                                      */
goptions display dev=vga;                                   

proc greplay igout=work.gseg nofs;                          
   replay _last_;                                           

   /* if graph is OK, then set DEV=HPLJ300 and               */ 
   /* replay it to the printer                               */ 
goptions dev=hplj300;                                       
   replay _last_;                                           
quit;                                                       


/**********************************************************************/


   /* Specify DEV=HPLJ300, CBACK=WHITE to simulate           */ 
   /* Laserjet format.                                       */ 
goptions nodisplay dev=hplj300 cback=white;             

   /* Run PROC GCHART to create catalog entry.               */  
proc gchart data=newsales;                              
   vbar region/sumvar=sales discrete patternid=midpoint;
run;                                                    

   /* Set DISPLAY, DEVICE=VGA, and HSIZE=5.35, and use       */
   /* PROC GREPLAY to preview graph.                         */
goptions display dev=vga hsize=5.35;                    

proc greplay igout=work.gseg nofs;                      
   replay _last_;                                       

   /* If graph is OK, set DEV=HPLJ300 and replay             */ 
   /* graph to get hard copy. Set HSIZE=0 so that            */ 
   /* graph takes up full page.                              */ 
goptions dev=hplj300 hsize=0;                           
   replay _last_;                                       
quit;                                                   


/**********************************************************************/