PLOT Procedure

Example 5: Plotting Data on a Logarithmic Scale

Features:

PLOT statement option:: HAXIS=

This example uses a DATA step to generate data. The PROC PLOT step shows two plots of the same data: one plot without a horizontal axis specification and one plot with a logarithmic scale specified for the horizontal axis.

Program

data equa;
   do Y=1 to 3 by .1;
      X=10**y;
      output;
   end;
run;
proc plot data=equa hpercent=50;
    plot y*x / vspace=1;
    plot y*x / haxis=10 100 1000 vspace=1;
    title 'Two Plots with Different';
    title2 'Horizontal Axis Specifications';
run;

Program Description

Create the EQUA data set. EQUA contains values of X and Y. Each value of X is calculated as 10Y.
data equa;
   do Y=1 to 3 by .1;
      X=10**y;
      output;
   end;
run;
Specify the plot sizes. HPERCENT= makes room for two plots side-by-side by specifying that 50% of the horizontal space is used for each plot.
proc plot data=equa hpercent=50;
Create the plots. The plot requests plot Y on the vertical axis and X on the horizontal axis. HAXIS= specifies a logarithmic scale for the horizontal axis for the second plot.
    plot y*x / vspace=1;
    plot y*x / haxis=10 100 1000 vspace=1;
Specify the titles.
    title 'Two Plots with Different';
    title2 'Horizontal Axis Specifications';
run;

Output

Two Plots with Different Horizontal Axis Specifications
Two Plots with Different Horizontal Axis Specifications