Programming the statistical procedures from SAS

Proc CORR, SAS Calculation Mystery

Reply
New Contributor
Posts: 2

Proc CORR, SAS Calculation Mystery

I have a question using Proc CORR. I used the following codes (the following is just an example) to find the Spearman correlations between variables:

Proc CORR data=use Spearman;
Var A B C D E ... L /*12 variables in total*/;
With F G H;
Run;

However, the result I got for correlations between A and F, or G, or H are slightly different from what I got if I use only:

Proc CORR data=use Spearman;
Var A;
With F G H;
Run;

From the SAS manual, I couldn’t tell why as the calculation formula would be the same for these correlations in both cases. Could anyone please shed some light?

Thank you!
Valued Guide
Posts: 2,108

Re: Proc CORR, SAS Calculation Mystery

This shouldn't happen. Seems like something to take to tech support.

If your data set is really large, you could be running into memory problems in the first example. However, I would expect a message in the log if that happened.

If you can reproduce the problem with some of the sample datasets that are provided with the SAS install, that will speed up the tech support resolution.
New Contributor
Posts: 2

Re: Proc CORR, SAS Calculation Mystery

Hi Doc,

Thanks for the reply. I did work with large datasets. I didn't notice warning of memory in the log though - which might very well be the case. I will try smaller datasets and ask again if this problem persists.

Thanks again.
Regular Contributor
Posts: 169

Re: Proc CORR, SAS Calculation Mystery

Doc is right if the code which was submitted is as shown in the initial post. However, if the NOMISS option was specified on either or both invocations of PROC CORR, then if there are any observations with missing values on {B,C,D,E,I,J,K,L} that do not have missing values in the set {A,F,G,H}, you would expect different results. So, the OP should confirm that (s)he did not include the NOMISS option in any of the invocations of PROC CORR.

If the NOMISS option was not employed, then the results are not expected and the problem should be reported to SAS tech support.
Ask a Question
Discussion stats
  • 3 replies
  • 65 views
  • 0 likes
  • 3 in conversation