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