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

I'd like to output the Pearson and Spearman coefficients that are provided in the proc freq measures option output to a dataset.  I'm comparing the association between a number of variables.

 

The code is a simple proc freq.

 

proc freq data=set;

table var1*(var2 var3 var4 var5 var6)/measures;

run;

 

Is there a way to save the Pearson and Spearman coefficients from the measures output to a dataset?  Ultimately, I'd like to create an ordered list of var2-var6 based on their Pearson and Spearman coefficients. 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You can use ODS OUTPUT. 

 

proc freq data=sashelp.cars;
table type*(origin drivetrain cylinders) / out=want measures;
ods output measures=want2;
run;

proc print data=want;
proc print data=want2;
run;

https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html

 


@cmtad wrote:

I'd like to output the Pearson and Spearman coefficients that are provided in the proc freq measures option output to a dataset.  I'm comparing the association between a number of variables.

 

The code is a simple proc freq.

 

proc freq data=set;

table var1*(var2 var3 var4 var5 var6)/measures;

run;

 

Is there a way to save the Pearson and Spearman coefficients from the measures output to a dataset?  Ultimately, I'd like to create an ordered list of var2-var6 based on their Pearson and Spearman coefficients. 


 

View solution in original post

3 REPLIES 3
Reeza
Super User

You can use ODS OUTPUT. 

 

proc freq data=sashelp.cars;
table type*(origin drivetrain cylinders) / out=want measures;
ods output measures=want2;
run;

proc print data=want;
proc print data=want2;
run;

https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html

 


@cmtad wrote:

I'd like to output the Pearson and Spearman coefficients that are provided in the proc freq measures option output to a dataset.  I'm comparing the association between a number of variables.

 

The code is a simple proc freq.

 

proc freq data=set;

table var1*(var2 var3 var4 var5 var6)/measures;

run;

 

Is there a way to save the Pearson and Spearman coefficients from the measures output to a dataset?  Ultimately, I'd like to create an ordered list of var2-var6 based on their Pearson and Spearman coefficients. 


 

snoopy369
Barite | Level 11

ODS OUTPUT is the way to go.

 

ods trace on;
ods output measures=measures;
proc freq data=sashelp.class;

table sex*(height weight)/measures;

run;
ods trace off;

I leave the ODS TRACE ON statements there so you can see how to get the name.

cmtad
Calcite | Level 5

Thanks so much, both of these solutions worked for me.

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, 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
  • 3 replies
  • 1624 views
  • 1 like
  • 3 in conversation