BookmarkSubscribeRSS Feed
Bill_in_Toronto
Obsidian | Level 7
Hi:
I need to set the horizontal and vertical axis range to be "0 to 40 by 5" in a matrix plot. I suspect it can be done with PROC TEMPLATE, but I can't find an example for PROC SGSCATTER. I'm using 9.2 under Windows workstation. The program is shown below. Can anyone provide an example?
Thanks.
------------

PROC SGSCATTER DATA=alldata_samples ;
MATRIX egbpm_daily_aggr_bc_ugm3 egbpmea_bc_ugm3 egbpmes_bc_ugm3 egbtms1_raw_avg egbtms2_raw_avg egbsp1c_avg egbsp2c_avg egbtmf2_raw_avg
/
GROUP=season;
RUN;
QUIT;
1 REPLY 1
DanH_sas
SAS Super FREQ
Hey Bill,

Unfortunately, you cannot currently set these ranges in PROC SGSCATTER or in the SCATTERPLOTMATRIX plot in GTL. However, you create your own matrix using LAYOUT LATTICE in GTL. I've included an example below. You can set your ranges on the ROWAXIS and COLUMNAXIS statements. Let me know if you have any other questions about it.

Thanks!
Dan

[pre]
proc template;
define statgraph matrix;
begingraph / designwidth=640 designheight=640;
layout lattice / columns=3 columnDataRange=union rowDataRange=union;
ColumnAxes;
ColumnAxis / display=(ticks tickvalues) displaysecondary=(ticks);
ColumnAxis / display=(ticks) displaysecondary=(ticks tickvalues);
ColumnAxis / display=(ticks tickvalues) displaysecondary=(ticks);
EndColumnAxes;
RowAxes;
RowAxis / display=(ticks) displaysecondary=(ticks tickvalues);
RowAxis / display=(ticks tickvalues) displaysecondary=(ticks);
RowAxis / display=(ticks) displaysecondary=(ticks tickvalues);
EndRowAxes;
layout overlay / border=true;
Entry "Weight";
endlayout;
ScatterPlot Y=Weight X=Cholesterol;
ScatterPlot Y=Weight X=Diastolic;
ScatterPlot Y=Cholesterol x=Weight;
layout overlay / border=true;
Entry "Cholesterol";
endlayout;
ScatterPlot Y=Cholesterol x=Diastolic;
ScatterPlot Y=Diastolic X=Weight;
ScatterPlot Y=Diastolic X=Cholesterol;
layout overlay / border=true;
Entry "Diastolic";
endlayout;
endlayout;
endgraph;
end;
run;

proc sgrender data=sashelp.heart template=matrix; run;
[/pre]

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
  • 1 reply
  • 1709 views
  • 0 likes
  • 2 in conversation