Data visualization with SAS programming

Controlling axis offset in SG plots

Reply
SAS Employee
Posts: 963

Controlling axis offset in SG plots

Sunil asked ...


Hello et al.,

I want to adjust XAXIS offset in PROC SGSCATTER how to do this?

Example, in AXIS statement we have option OFFSET=(x,y)unit. Here we can adjust, the same way how can i do this in PROC SGSCATTER.
This is my sample code

ods listing close;
goptions reset=goptions device=png target=png;
ods rtf file='Scatterplot.rtf';
ods graphics / reset width=600px height=400px imagename='ScatterPlot' imagefmt=gif;
title "Height vs Weight Statistics";
proc sgscatter data=sashelp.class;
plot weight * height /
group=sex;
run;

ods rtf close;
ods listing;

appreciate your suggestions.

warm regards,
Suniel

-----

DanH provided the tip:

You can set the axis offset in SGPLOT.

-----

And I thought I'd provide a simple example showing the syntax:

proc sgplot data=sashelp.iris;
scatter x=petallength y=petalwidth / group=species;
yaxis label="Petal Width" grid values=(0 to 30 by 10) offsetmin=0 offsetmax=0;
xaxis label="Petal Length" grid values=(0 to 80 by 20) offsetmin=0 offsetmax=0;
run;


And, just to be complete, here's a gchart example showing how to control the axis offset there...

axis1 label=(angle=90 "Petal Width") order=(0 to 30 by 10) minor=none offset=(0,0);
axis2 label=("Petal Length") order=(0 to 80 by 20) minor=none offset=(0,0);
proc gplot data=sashelp.iris;
plot petalwidth*petallength=species /
vaxis=axis1
haxis=axis2
autovref cvref=graydd
autohref chref=graydd;
run;
N/A
Posts: 0

Re: Controlling axis offset in SG plots

Hi,

I tried to tun the sample code of the Iris data, but got the error message as below:

"
Error 22-322: Syntax error, expeting one of the following: ;, DISCRETEORDER, DISPLAY, FITPOLICY, GRID, INTEGER, LABEL, LOGBASE, LOGSTYLE, MAX, MIN, MINOR, NOTIMESPLIT, REFTICKS, TYPE, VALUES, VALUESHINT.

Error 76-322: Syntax error, statement will be ignored.
"

I have the same problem when I was running the other code in PROG SGPLOT when I was trying to adjust the offset, so I guess something is going wrong with the offsetmin= or offsetmax= options. Any suggestions?

I am running SAS 9.2 TS Level 1M0 on 32 bit Win Xp platform. Thanks!
SAS Employee
Posts: 963

Re: Controlling axis offset in SG plots

I'm running the code at 9.2 (TS2M2), on Windows, and it's running successfully for me there. When it comes to the "ODS Graphics" and "SG" stuff, I'd recommend having the latest SAS release.

Perhaps Dan can provide some more insight into whether this should work in the slightly older version you're using(?)
N/A
Posts: 0

Re: Controlling axis offset in SG plots

I found the below from the online manual regarding offsetmin= / offsetmax= in SGPLOT:

Restriction: This option is available with SAS 9.2 Phase 2 and later


So, I guess I'm running on Phase 1 product (1M0)?

Dan, any hints how can I upgrade to Phase 2? Thanks!
SAS Super FREQ
Posts: 8,645

Re: Controlling axis offset in SG plots

Hi:
This note explains the process:
http://support.sas.com/kb/35/445.html

cynthia
SAS Employee
Posts: 963

Re: Controlling axis offset in SG plots

Note that that doc tells you how to get "Phase 2" (TS2), but while you're at it, I would recommend also getting the "Maintenance 2" (M2) for Phase 2. ...

9.2 (TS2M2)
N/A
Posts: 0

Re: Controlling axis offset in SG plots

Thanks for suggestions.

So you mean the M2 is applied after the Phase 2 upgrade, right? I am a bit confused with all these upgrade, do you know where can I find the differences among all these versions (TS1M0, TS2M0, TS2M2 ..) Thanks!
Post a Question
Discussion Stats
  • 6 replies
  • 140 views
  • 0 likes
  • 3 in conversation