turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- How to creat a scatterplot matrix?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2010 03:18 AM

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.

It took me several hours to try this, but still not get it...

Thank you guys.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2010 03:48 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2010 02:51 PM

I have tried, but does not work. Is it because I have one more variable than your example?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2010 03:30 PM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2010 03:49 PM

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.

I am using sas 9.0, i think that is the problem.

I will try to find a sas 9.2 to try.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2010 04:00 PM

I got it perfectly!

Thank you. yes, we need sas 9.2.

Thank you. yes, we need sas 9.2.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-21-2010 04:03 PM

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.

I appreciate your help so much.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-22-2010 12:16 AM

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

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