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

Hi ,

I have to compute correlation of the aproximately 11000 variables. But Proc Corr has restriction of 3000 variables. Could anybody suggest me, if there is any alternative way to accomplish this task. Could you also provide me the possible SAS code(s).

Shyam

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

You can use a macro to walk throught every single variable for all of them , then append them all together.

data x;
 array _a{*} a1-a11000;
 do j=1 to 10 ;
 do i=1 to dim(_a);
  _a{i}=ranuni(0);
 end;
 output; 
end;drop i j;
run;
proc corr data=x outp=want1 noprint;
 var _all_;
 with a1;
run;

proc corr data=x outp=want2 noprint ;
 var _all_;
 with a2;
run;

 
.............. and so on 

Ksharp

View solution in original post

4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12

You could do a series of PROC CORRs with chunks of the variables, output the results and then combine the results to further process them.  It is just 16 PROC CORR executions.  Che the documentation for how to code it.

I question the wisdom of that many correlations; some of the results will be just spurious noise.

Doc Muhlbaier

Duke

Ksharp
Super User

You can use a macro to walk throught every single variable for all of them , then append them all together.

data x;
 array _a{*} a1-a11000;
 do j=1 to 10 ;
 do i=1 to dim(_a);
  _a{i}=ranuni(0);
 end;
 output; 
end;drop i j;
run;
proc corr data=x outp=want1 noprint;
 var _all_;
 with a1;
run;

proc corr data=x outp=want2 noprint ;
 var _all_;
 with a2;
run;

 
.............. and so on 

Ksharp

shyam
Calcite | Level 5

Thanks Ksharp for your coding help. Comments form Doc@Duke and PaigeMiller appreciated.

PaigeMiller
Diamond | Level 26

Doc@Duke said

I question the wisdom of that many correlations; some of the results will be just spurious noise.

This is wise advice. What are you going to do with 11000*10999/2 > 60 million correlations? What is the real problem you are trying to solve with this data?

--
Paige Miller

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 991 views
  • 6 likes
  • 4 in conversation