- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So, you want one Scatter Plot for each of your variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
matrix _numeric_;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
...