BookmarkSubscribeRSS Feed
GraphGuy
Meteorite | Level 14
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;
6 REPLIES 6
deleted_user
Not applicable
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!
GraphGuy
Meteorite | Level 14
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(?)
deleted_user
Not applicable
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!
Cynthia_sas
SAS Super FREQ
Hi:
This note explains the process:
http://support.sas.com/kb/35/445.html

cynthia
GraphGuy
Meteorite | Level 14
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)
deleted_user
Not applicable
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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4037 views
  • 0 likes
  • 3 in conversation