- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
Is there a quick way to exclude number of observations in the correlation matrix created by proc corr?
Thanks a lot!
Lizi
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Then an alternative is to modify the template that drives proc corr. e.g.:
ods path work.template(update) sashelp.tmplmst; proc template; edit base.corr.stackedmatrix; column (RowName RowLabel) (Matrix) * (Matrix2) /** (Matrix3)*/ * (Matrix4); end; run; proc corr data=sashelp.cars; run; proc template; delete base.corr.stackedmatrix; run;
In the above code I've made a temporary template replacement for proc corr that has * (Matrix3) commented out. Since Matrix3 contains the N values, they won't appear in the output.
HTH,
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you be more specific? I can't see which N you may be referring to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you're asking about the N values shown (along with correlations and pvalues) in each cell of the matrix, you can easily eliminate their appearance if you choose to exclude all cases that have any missing values. That way, the N will only show up once, above the correlation matrix.
That can be done by selecting the NOMISS option. e.g.:
proc corr data = sashelp.cars nomiss; run;
HTH,
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The only problem is that NOMISS excludes all cases with missing values. I need to keep all non-missing data for their correlations, but don't want to display the sample size in the output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Then an alternative is to modify the template that drives proc corr. e.g.:
ods path work.template(update) sashelp.tmplmst; proc template; edit base.corr.stackedmatrix; column (RowName RowLabel) (Matrix) * (Matrix2) /** (Matrix3)*/ * (Matrix4); end; run; proc corr data=sashelp.cars; run; proc template; delete base.corr.stackedmatrix; run;
In the above code I've made a temporary template replacement for proc corr that has * (Matrix3) commented out. Since Matrix3 contains the N values, they won't appear in the output.
HTH,
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot, Art!