Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

HOW DO YOU CREATE A NEW DATASET WITH THE PROC CORR OUTPUT?

Reply
Occasional Contributor
Posts: 5

HOW DO YOU CREATE A NEW DATASET WITH THE PROC CORR OUTPUT?

I am trying to use the output from a covariance matrix in an optimization model.  I want the output to look like the PROC CORR output, but instead get the output with type, obs, and name.  Is there a way to create a new dataset that matches the PROC CORR output?  If there is a altogether better way to do this, please let me know.  Thank you. 

 

ods select Cov PearsonCorr;
proc corr data=ret_monthly noprob outp=CovMat cov nocorr;
	var EOG_monret CAT_monret DE_monret LNG_monret GD_monret;
	Title "Covariance Matrix";
run;

proc print data=CovMat NOOBS; 
	Title "Covariance Matrix";
run;

 

 

SAS Super FREQ
Posts: 496

Re: HOW DO YOU CREATE A NEW DATASET WITH THE PROC CORR OUTPUT?

Your other option is:

ods output pearsoncorr=p;

 

The data set has one set of variable for r, p, and n.  If you want to stack things to look like they do in the output, you will need to use a DATA step.

Trusted Advisor
Posts: 1,284

Re: HOW DO YOU CREATE A NEW DATASET WITH THE PROC CORR OUTPUT?

What exactly do you mean by "a new dataset that matches the proc corr output"?  Please provide an example.

Ask a Question
Discussion stats
  • 2 replies
  • 159 views
  • 0 likes
  • 3 in conversation