SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Enhancing and Exporting Charts and Plots
Lesson Summary

This page contains


I. Text Summary

To go to the page where a task, programming feature, or concept was presented, select a link.

Assigning Descriptive Labels
You can use the LABEL statement to assign more descriptive text to the variables in your SAS/GRAPH output.

Formatting Data Values
You can control how values are displayed by using a FORMAT statement.

Specifying Titles and Footnotes
To specify titles and footnotes for your SAS/GRAPH output, you can use TITLE and FOOTNOTE statements. You can control the appearance of titles and footnotes by specifying the color, height, and font used in the text with the COLOR=, FONT=, and HEIGHT= options. Titles and footnotes have the default values shown for the COLOR=, FONT=, and HEIGHT= options.

Controlling HBAR Statistics
You can control which statistics are displayed to the right of the bars on a horizontal bar chart. You can also use the FREQLABEL=, CFREQLABEL=, PERCENTLABEL=, CPERCENTLABEL=, SUMLABEL=, and MEANLABEL= statements to assign descriptive labels to the statistics.

Controlling VBAR Statistics
By default, only one statistic is displayed for VBAR charts. The OUTSIDE= option allows you to display a statistic above the bars in a vertical bar chart. The INSIDE= option allows you to display a statistic within the bars.

Exporting Graphs
You can export graphs that you have created in SAS to a wide variety of graphics formats, either interactively or by using program statements.

Sizing Graphs
You can size graphs using either the HSIZE= and VSIZE= options or the XPIXELS= and YPIXELS= options, depending on whether you create your graph in the GRAPH window or export your graphs directly to external files using program statements.

Additional Features
You can use a number of options within the GCHART and GPLOT procedures to further enhance your graphs. In addition to the capabilities of the GCHART and GPLOT procedures, SAS/GRAPH software enables you to
  • specify a number of graphics options
  • create custom device drivers that contain all the commands for producing a graphics stream file
  • save multiple graphs at a time
  • create HTML output using ODS
  • create custom fonts and custom legends
  • display data or geographic maps using GMAP
  • manage catalogs of graphics output using PROC GREPLAY
  • use PROC GREPLAY to display two or more graphs in one output file
  • customize graphics output using the ANNOTATE facility
  • create three-dimensional response surface images using PROC G3D

and much more.


II. Syntax

To go to the page where a statement or option was presented, select a link.

FILENAME fileref 'filename';
GOPTIONS <GSFNAME=fileref> <DEVICE=device-driver>
                     <HSIZE=horizontal-size <IN | CM | PT>
                       VSIZE=vertical-size <IN | CM | PT>>
                      <XPIXELS=width-in-pixels
                        YPIXELS=height-in-pixels>;
TITLE<n>  <COLOR=color> 
                    <HEIGHT=height-value <units>>   
                    <FONT=font-name>
                     'title-text' | "title-text";
FOOTNOTE<n>  <COLOR=color>   
                              <HEIGHT=height-value <units>>  
                              <FONT=font-name>  
                              'footnote-text' | "footnote-text";
PROC GCHART <DATA=SAS-data-set>;
         HBAR chart-variable </ statistic
                     FREQLABEL= | SUMLABEL= |
                     PERCENTLABEL= | MEANLABEL= 'label-text'>;
         VBAR chart-variable </
                     OUTSIDE=statistic INSIDE=statistic>;
         FORMAT variable(s) format;
         LABEL variable='label-text' <...variable<n>='label-text<n>';
RUN;


III. Sample Program

     filename bargif1 'g:\images\barchart1.gif';
goptions gsfname=bargif1 device=gif
xpixels=500 ypixels=400; title1 color=red height=0.5 cm 'Total Fees by Activity Level, Males'; footnote1 height=0.5 cm color=blue
font=centx 'Current Month';
proc gchart data=clinic.admit; hbar actlevel / sumvar=fee patternid=midpoint sum sumlabel='Fees by Level'; where sex='M'; label actlevel='Activity Level'; format fee dollar5.; run; goptions hsize=4in vsize=4in; title1 color=red height=0.5 cm 'No. of Clients by Activity Level'; footnote1 height=0.5 cm color=blue font=centx 'YTD FY1998'; proc gchart data=clinic.admit; vbar sex / group=actlevel patternid=midpoint outside=cfreq inside=freq; run;

IV. Points to Remember
  • FILENAME, GOPTIONS, TITLE, and FOOTNOTE statements are global and remain in effect until you cancel them, modify them, or end your SAS session.

  • Be sure to match quotes enclosing text in TITLE, FOOTNOTE, LABEL, and FORMAT statements.

  • If statistics displayed for VBAR charts are wider than the bars, the statistics may not display properly.

  • To end a RUN-group procedure, you must submit another PROC step, a DATA step, or a QUIT statement.



back||next

 

Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement