PROC GPLOT options: AUTOHREF and AUTOVREF

This post was kindly contributed by SAS & Statistics - go there to comment and to read the full post.

Use the AUTOHREF and AUTOVREF options on the PLOT statement of PROC GPLOT to draw reference lines at all major tickmarks. Create an annotate data to draw thicker reference lines at the desired tickmarks.

goptions reset=all;

/* Create sample data */
data a;
input x y;
cards;
1 30
2 15
3 40
4 80
5 35
6 40
7 85
8 75
9 55
10 30
;
run;

/* Create an annotate data set to draw darker reference lines */
/* at X values of 3, 6, and 9; Y values of 20, 50, and 80. */
/* The SIZE variable sets the line thickness. */
data anno;
&nbsp &nbsp &nbsp length function color $ 8;
&nbsp &nbsp &nbsp /* Vertical reference lines */
&nbsp &nbsp &nbsp do x=3 to 9 by 3;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp function=’move’; xsys=’2′; ysys=’1′;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp y=0; output;

&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp function=’draw’; xsys=’2′; ysys=’1′;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp size=3; line=1; color=’black’; y=100; output;
&nbsp &nbsp &nbsp end;

&nbsp &nbsp &nbsp /* Horizontal reference lines */
&nbsp &nbsp &nbsp do y=20 to 80 by 30;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp function=’move’; xsys=’1′; ysys=’2′;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp x=0; output;

&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp function=’draw’; xsys=’1′; ysys=’2′;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp size=3; line=1; color=’black’; x=100; output;
&nbsp &nbsp &nbsp end;
run;

/* Create the graph. */
proc gplot data=a;
&nbsp &nbsp &nbsp plot y*x / haxis=axis1 vaxis=axis2 autohref autovref noframe annotate=anno;

&nbsp &nbsp &nbsp symbol1 i=none v=dot c=blue;
&nbsp &nbsp &nbsp axis1 order=(0 to 12 by 1);
&nbsp &nbsp &nbsp axis2 order=(0 to 100 by 10);
&nbsp &nbsp &nbsp title1 h=1.5 f=swiss ‘Reference Lines of Varying Thickness’;
run;
quit;

This post was kindly contributed by SAS & Statistics - go there to comment and to read the full post.