Data visualization with SAS programming

PROC SGSCATTER with axis statement

Reply
Occasional Contributor
Posts: 16

PROC SGSCATTER with axis statement

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;
SAS Super FREQ
Posts: 925

Re: PROC SGSCATTER with axis statement

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]
Ask a Question
Discussion stats
  • 1 reply
  • 394 views
  • 0 likes
  • 2 in conversation