BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fatemeh
Quartz | Level 8

Hello,

How to get scatter plot for all my variables using proc corr in sas 9.4?

I am applying proc corr to find correlation between response variable(y) and independent variables, It gives me scatter plot for only 9 of my variables. Appreciate for any help.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The documentation states "If the resulting maximum number of variables in the VAR or WITH list is greater than 10, only the first 10 variables in the list are displayed in the scatter plots."

An easy way to circumvent this restriction is to call PROC CORR several times, as follows:

proc corr data=mydata rank  plots=scatter(nvar=all);
var T0-T8;    
with y;
run;
proc corr data=mydata rank  plots=scatter(nvar=all);
var B0-B8;    
with y;
run;
proc corr data=mydata rank  plots=scatter(nvar=all);
var G0-G8;    
with y;
run;

...

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

So, you want one Scatter Plot for each of your variables?

 

Try PROC SGPLOT with the Scatter Statement.

ballardw
Super User

Proc CORR only deals with numeric variables. How many of your variables are numeric?

And if any specific variable is missing for all values of another there is nothing to plot or calculate correlations with.

 

What does the LOG look like when you run the code? Best is to show the Log of any procedure you have questions about. Copy the entire code with any notes or messages from the Log and paste into a text box opened on the forum with the </> icon to preserve formatting.

 

Instead of attachments for code it is better to just copy the code or other text and paste into a text box such as:

proc corr data=mydata rank  plots=scatter(nvar=all);
 
var T0-T8  b0-b8  g0-g8 h0-h8       
    d0-d8  f0-f8 j0-j8  k0-k8;    
with y;

run;

 

Ksharp
Super User
proc sgscatter data=sashelp.heart;
matrix _numeric_;
run;
Rick_SAS
SAS Super FREQ

The documentation states "If the resulting maximum number of variables in the VAR or WITH list is greater than 10, only the first 10 variables in the list are displayed in the scatter plots."

An easy way to circumvent this restriction is to call PROC CORR several times, as follows:

proc corr data=mydata rank  plots=scatter(nvar=all);
var T0-T8;    
with y;
run;
proc corr data=mydata rank  plots=scatter(nvar=all);
var B0-B8;    
with y;
run;
proc corr data=mydata rank  plots=scatter(nvar=all);
var G0-G8;    
with y;
run;

...

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 3068 views
  • 9 likes
  • 5 in conversation