Help using Base SAS procedures

How to creat a scatterplot matrix?

Reply
N/A
Posts: 0

How to creat a scatterplot matrix?

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.
Super User
Posts: 9,687

Re: How to creat a scatterplot matrix?

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
N/A
Posts: 0

Re: How to creat a scatterplot matrix?

I have tried, but does not work. Is it because I have one more variable than your example?
SAS Super FREQ
Posts: 8,743

Re: How to creat a scatterplot matrix?

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
N/A
Posts: 0

Re: How to creat a scatterplot matrix?

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.
N/A
Posts: 0

Re: How to creat a scatterplot matrix?

I got it perfectly!
Thank you. yes, we need sas 9.2.
N/A
Posts: 0

Re: How to creat a scatterplot matrix?

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.
SAS Super FREQ
Posts: 8,743

Re: How to creat a scatterplot matrix?

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
Ask a Question
Discussion stats
  • 7 replies
  • 123 views
  • 0 likes
  • 3 in conversation