BookmarkSubscribeRSS Feed
ChuckK
Calcite | Level 5

Hello All,

I wanted to see if there was anything new about changing the aspect ratio of the cell within SGPLOT. I know you can set the width and height in the template or by using the ODS GRAPHICS statement. As you know, though, that is for the entire output area. It does not give the same graph aspect ratio when there is a legend and when there's not, for example.

Is there a way to specifically set the width and height of the cell in SGPLOT.

Thanks for any help or suggestions.

Chuck

2 REPLIES 2
GraphGuy
Meteorite | Level 14

Since nobody replied with an sgplot answer, here's a gplot alternative...

In gplot, you can specify the exact desired length of the axes (and thereby control the aspect ratio), using axis statements, such as:

axis1 length=2in;
axis2 length=4in;

proc gplot data=sashelp.class;
plot height*weight / vaxis=axis1 haxis=axis2;
run;

BrunoMueller
SAS Super FREQ

I do not know of how to specify an exact height and width, but there are the OFFSETMIN= and OFFSETMAX= options for the XAXIS and YAXIS statements, they allow you to controll how much space is used for the plotting, find a sample code below that illustrates this:

proc sgplot data=sashelp.class;
  vbar age / group=sex;
  xaxis offsetmax=0.3;
 
yaxis offsetmax=0.3;
 
keylegend / location=inside position=topright across=1;
run;

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
  • 2 replies
  • 1482 views
  • 0 likes
  • 3 in conversation