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
- /
- Base SAS Programming
- /
- How to save proc freq result as a table?

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

04-06-2017 12:13 AM

This should be pretty much straightforward but I can't get it work even after reading through the documentation...

```
/*save the var1 freq table*/
proc freq data=have order=freq ;
output out=var1_freq;
tables var1/list missing;
run;
/*save the two freq tables*/
proc freq data=have order=freq ;
output out=var1_freq var1var2_freq;
tables var1 var1*var2/list missing;
run;
```

Accepted Solutions

Solution

04-06-2017
01:25 AM

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

Posted in reply to afiqcjohari

04-06-2017 12:46 AM

Read the warnings in your log. Always.

They state that a statistic is required.

OUT on the TABLES statement is used to capture the frequencies.

OUTPUT statement is used to capture test statistics.

ODS OUTPUT is a different way to keep the counts.

See the example below.

Proc freq data=SASHELP.class;

tables sex / out = freqs chisq;

output out= stats chisq;

ODS onewayFreq= frreqs2;

run;

All Replies

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

Posted in reply to afiqcjohari

04-06-2017 12:27 AM

proc freq data=have order=freq ;

tables var1/list missing out=var1_freq;

run;

/*save the two freq tables*/

proc freq data=have order=freq ;

tables var1 var1*var2/list missing out=var2_freq;

run;

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

Posted in reply to afiqcjohari

04-06-2017 12:28 AM

proc freq data=have;

tables var1/out=var1_data;

tables var1*var2/out=var2_data;

run;

tables var1/out=var1_data;

tables var1*var2/out=var2_data;

run;

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

Posted in reply to lakshmi_74

04-06-2017 01:35 AM

But it seems that the output doesn't include the cumulative frequency and cumulative percent. Is it possible to get these variables as well?

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

Posted in reply to afiqcjohari

04-06-2017 08:45 AM

RTM for the options on the TABLES statement that control the output.

Solution

04-06-2017
01:25 AM

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

Posted in reply to afiqcjohari

04-06-2017 12:46 AM

Read the warnings in your log. Always.

They state that a statistic is required.

OUT on the TABLES statement is used to capture the frequencies.

OUTPUT statement is used to capture test statistics.

ODS OUTPUT is a different way to keep the counts.

See the example below.

Proc freq data=SASHELP.class;

tables sex / out = freqs chisq;

output out= stats chisq;

ODS onewayFreq= frreqs2;

run;

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

Posted in reply to Reeza

04-06-2017 01:26 AM

I see, thanks for the explanation Reeza.