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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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