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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 2028 views
  • 0 likes
  • 2 in conversation