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

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
ballardw
Super User

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

3 REPLIES 3
Reeza
Super User

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.

jacob_klimek
Obsidian | Level 7

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?

ballardw
Super User

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

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
  • 1035 views
  • 0 likes
  • 3 in conversation