BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have one dependent variable y, three independent variables x1, x2, x3, and I want to creat a scatterplot matrix.
It took me several hours to try this, but still not get it...
Thank you guys.
7 REPLIES 7
Ksharp
Super User
There are lots of way to get it. and Cynthia@sas.com can do it very well.
The following code is one of these ways.

[pre]
ods graphics on;
proc corr data=sashelp.class plots=matrix;
var weight height ;
run;
ods graphics off;







proc sgscatter data=sashelp.class;
compare y=age x=(weight height);
run;
















proc sgscatter data=sashelp.class;
matrix age weight height;
run;


[/pre]



Ksharp Message was edited by: Ksharp
deleted_user
Not applicable
I have tried, but does not work. Is it because I have one more variable than your example?
Cynthia_sas
SAS Super FREQ
Hi:
Either PROC CORR or SGSCATTER will work with 3 variables, as shown in the code below, which uses SASHELP.HEART data:
[pre]

ods graphics on;
proc corr data=sashelp.heart plots=matrix;
var weight height systolic;
run;
ods graphics off;

proc sgscatter data=sashelp.heart;
compare y=ageatdeath x=(weight height systolic);
run;

proc sgscatter data=sashelp.heart;
matrix ageatdeath weight height systolic;
run;
[/pre]

Do you have SAS 9.2 and SAS/GRAPH???? If you are only running SAS 9.1.3, ODS GRAPHICS capability was still experimental in SAS 9.1.3 and SGSCATTER was not available. In SAS 9.2 the SG procedures and ODS GRAPHICS became production.

You say that you tried, but the code does not work. Can you share your program and the error message in the SAS log??? Also, for more help from graphics folks, you might consider posting this question (with code examples) in the SAS/GRAPH and ODS GRAPHICS forum.

cynthia
deleted_user
Not applicable
Thank you so much!
I am using sas 9.0, i think that is the problem.
I will try to find a sas 9.2 to try.
deleted_user
Not applicable
I got it perfectly!
Thank you. yes, we need sas 9.2.
deleted_user
Not applicable
And actually, I want to get the coefficients and means in the matrix too, could you help me with that too?
I appreciate your help so much.
Cynthia_sas
SAS Super FREQ
Hi:
I don't actually use SGSCATTER that much. I'm more of an SGPLOT person.

You might want to post your current code to the SAS/GRAPH and ODS Graphics forum and ask your question there. In the meantime, perhaps these will get you started:
http://support.sas.com/kb/37/000.html
http://support.sas.com/documentation/cdl/en/grstatproc/62603/HTML/default/viewer.htm#sgscatter-ov.ht...

In the doc link, there's an example of getting an ELLIPSE on the scatter plots with TYPE=MEAN
[pre]
matrix petallength petalwidth sepallength
/ ellipse=(type=mean)
diagonal=(histogram kernel);
[/pre]

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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