BookmarkSubscribeRSS Feed
VD
Calcite | Level 5 VD
Calcite | Level 5
Is there an option available to plot (in gplot or any other proc) actual distributions of variables at both the x- and y-axis within the graph which displays y*x plot?
4 REPLIES 4
GraphGuy
Meteorite | Level 14
There might be something easier & more automated in the newer ODS graphics, but here are 2 techniques you could use with the traditional SAS/Graph gplot and annotate:

http://robslink.com/SAS/democd8/margin.htm
http://robslink.com/SAS/democd8/margin_info.htm

http://robslink.com/SAS/democd29/mpgsuv.htm
http://robslink.com/SAS/democd29/mpg_info.htm
VD
Calcite | Level 5 VD
Calcite | Level 5
Excellent. Many thanks, Robert.
DanH_sas
SAS Super FREQ
If you have SAS 9.2, you can run the code below to get what you want. YOu only need to submit the template once. After that, you can run PROC SGRENDER with different data sets and X/Y variables. Let me know if you have any questions.

Thanks!
Dan

proc template;
define statgraph histplot;
dynamic XVAR YVAR;
begingraph;
layout lattice / columndatarange=union columngutter=10 columnweights=(0.75 0.25 ) columns=2
rowdatarange=union rowgutter=10 rowweights=(0.25 0.75 ) rows=2;
layout overlay;
histogram XVAR / binaxis=false name='histogram';
endlayout;
layout overlay;
entry halign=center ' ' / valign=center;
endlayout;
layout overlay;
scatterplot x=XVAR y=YVAR / name='scatter';
endlayout;
layout overlay;
histogram YVAR / binaxis=false name='histogram_h' orient=horizontal;
endlayout;
rowaxes;
rowaxis;
rowaxis;
endrowaxes;
columnaxes;
columnaxis;
columnaxis;
endcolumnaxes;
endlayout;
endgraph;
end;
run;

proc sgrender data=SASHELP.CLASS template=histplot;
dynamic XVAR="weight" YVAR="height";
run;
VD
Calcite | Level 5 VD
Calcite | Level 5
Many thanks, Dan. A very convenient piece of code. Unfortunately, still on 9.1! Will keep this for future.

Vikas

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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