Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Tables Output from proc freq

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-14-2016 02:16 PM
(1368 views)

Hello,

I am trying to put together a bunch of partial proc freq tables and would like to do this automatically if possible. What I have is a bunch of proc freqs that are cross tabs of two different binary indicator variables. An example is:

Table of iah by prov |
|||

iah |
prov |
||

Frequency Percent Row Pct Col Pct |
0 |
1 |
Total |

0 |
168177 34.08 34.15 99.67 | 324327 65.73 65.85 99.88 | 492504 99.81 |

1 |
553 0.11 59.08 0.33 |
383 0.08 40.92 0.12 |
936 0.19 |

Total |
168730 34.19 | 324710 65.81 | 493440 100.00 |

From this (and about 20 more) I want to grab the bolded red numbers from each of the 20 tables to make a new dataset/table that I can print and have to output to excel. I just don't know how to reference these values.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If this is to make a report you might look at a different proc.

Maybe something like:

proc tabulate data= have;

class prov;

var prog_1 prog_2 prog_3 ...; /* if they are all named prog_ you could use a variable list like prog_: */

table Prog_1 prog_2 prog_3 ,

(prov All='Total') * sum="";

run;

This wll work for variables coded 0/1 as the sum would be the count of 1 values.

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Definitely, yeah I have never had an output related question like this before.

So for the proc freq I guess it isn't multiple proc freqs (I could do a macro though if necessary), but the command is like this.

proc freq data=test; table prog_1*prov prog_2*prov prog_3*prov;run;

and what I want is a table to be like the following

prov=1 prov=0 prov total

prog_1=1 2 3 5

prog_2=1 4 2 6

prog_3=1 7 0 7

Does this help?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If this is to make a report you might look at a different proc.

Maybe something like:

proc tabulate data= have;

class prov;

var prog_1 prog_2 prog_3 ...; /* if they are all named prog_ you could use a variable list like prog_: */

table Prog_1 prog_2 prog_3 ,

(prov All='Total') * sum="";

run;

This wll work for variables coded 0/1 as the sum would be the count of 1 values.

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

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.

Ready to level-up your skills? Choose your own adventure.