SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Plots
Scaling Axes


To scale the axes in your plot, you can specify the VAXIS= and HAXIS= options in the PLOT statement. The VAXIS= option specifies tick marks along the vertical axis, and the HAXIS= option specifies tick marks along the horizontal axis. Notice that a slash (/) precedes options in the PLOT statement.


General form, PLOT statement with VAXIS= and HAXIS= options:
PLOT vertical-variable*horizontal-variable /
           VAXIS=<value-list | range>
           HAXIS=<value-list | range>;

where value-list or range determines the placement of tick marks along the axis.

NOTE: If some values for the horizontal axis are not plotted within the value list or range specified, the data for those values will not appear on the plot.


Specifying Values

As you saw above, you can scale axes using

  • a value list:

    haxis='MON' 'TUES' 'WED' 'THUR' 'FRI'
  • a range of values:

    vaxis=10 to 100 by 10

Let's see how each of these methods works.


Value Lists

Notice the default scaling for the axes in the plot below. All months of the year are represented.


Single plot with default axes.

But suppose you want to plot only January, June, and December. By specifying the HAXIS= option, shown below, you can scale the horizontal axis using only the values listed. Note that Month is a character variable, even though its values are digits. You must enclose character values in quotes and specify them exactly as they appear in the data set.

   proc gplot data=clinic.therapy1999;
plot aerclass*month /
haxis='01' '06' '12';
run;

Single plot with optional horizontal axis.

Notice the modified horizontal axis. Also, points are plotted only for the months that HAXIS= specifies.


back||next


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

Terms of Use & Legal Information | Privacy Statement