turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Output Proc Freq Measures to a dataset

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-03-2018 02:09 PM

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.

Accepted Solutions

Solution

01-03-2018
02:29 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cmtad

01-03-2018 02:13 PM

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.

All Replies

Solution

01-03-2018
02:29 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cmtad

01-03-2018 02:13 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cmtad

01-03-2018 02:13 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to snoopy369

01-03-2018 02:29 PM

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