Help using Base SAS procedures

Tables Output from proc freq

Accepted Solution Solved
Reply
Contributor
Posts: 39
Accepted Solution

Tables Output from proc freq

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


Accepted Solutions
Solution
‎03-16-2016 11:07 AM
Super User
Posts: 11,343

Re: Tables Output from proc freq

[ Edited ]
Posted in reply to jacob_klimek

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.

View solution in original post


All Replies
Super User
Posts: 19,815

Re: Tables Output from proc freq

Posted in reply to jacob_klimek

Can you please post a sample of what you want your output to look like, as well as how you're running your multiple proc freqs or table statements.

Contributor
Posts: 39

Re: Tables Output from proc freq

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?

Solution
‎03-16-2016 11:07 AM
Super User
Posts: 11,343

Re: Tables Output from proc freq

[ Edited ]
Posted in reply to jacob_klimek

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 412 views
  • 0 likes
  • 3 in conversation