Learning SAS? Welcome to the exclusive online community for all SAS learners.

Help with Proc Corr?

Reply
Occasional Contributor
Posts: 19

Help with Proc Corr?

I have four data sets D1, D2, D3 and D4 which have same variable names. These data sets share variables of same name. Goal is to perform correlation between variables of one data with that of another data set.

Example: if Dataset has data D1 has variables: var1 var2 var3

and dataset D2 has variables: var1 var2 var3

Inorder to perform correlation between the variables var1 to var3 with those of dataset D2, I  renamed the variables of data set D2 as var1_d2 var2_d2 var3_d2. Then merge D1 and D2 and the final data set is D_New

Using proc corr data = D_New;

         var var1;

with var1_d2 var2_d2 var_d3;

run;

Can anyone please suggest any other way of obtaining correlations across data sets?

Trusted Advisor
Posts: 1,619

Re: Help with Proc Corr?

I don't think there is a simpler way to do this. What is wrong with this method?

Occasional Contributor
Posts: 19

Re: Help with Proc Corr?

If there are 3gb or larger than this size of data, the problem I the code will take long time to run. I was thinking how I could make it efficient. Please advise me if you have any suggestion?

Super User
Posts: 10,514

Re: Help with Proc Corr?

If part of your 3gb of data is not to be analyzed then use the KEEP or DROP options to have only the variables you need may help.

Occasional Contributor
Posts: 19

Re: Help with Proc Corr?

I agree with you but if have a data whose story is not known, then what would you recommend. Won't the idea of correlation be better for all the variables ?

Super User
Posts: 9,682

Re: Help with Proc Corr?

Not sure . try to post it at  

Maybe Rich could give you a surprise .

Ask a Question
Discussion stats
  • 5 replies
  • 416 views
  • 0 likes
  • 4 in conversation