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

HI everyone,

I am trying to create a report using proc freq:

PROC FREQ DATA=WORK.PICKSTA ORDER=FREQ FORMCHAR (1,2,7)='   ';

TABLE PART*WBC / OUT=WORK.FREQWBC NOPCT NOROW NOCOL;     

Output:                                                                                                                       

PART          WBC                                                                                                                                                                                                                                  

Frequency     I        P        S        A        J        K        D        H        C        F        E          Total                                                                                                                          

RE539279           48        1        7        0        0        0        0        0        0        0        0       56                                                                                                                          

AM106627           52        0        0        0        0        0        0        0        0        0        0       52                                                                                                                          

AL213212           35        0        1        0        0        0        0        0        0        0        0       36                                                                                                                          

AL172780           16        0        2        0       12        0        0        0        0        0        0       30

   

Is it possible to create a similar output but additionally use subgroups? The output should be:

´

PART         Subgoup    WBC                                                                                                                                                                                                                                  

Frequency               I     P     S        A        J        K        D        H        C        F        E      Total                                                                                                                          

RE539279     A         48     1     7        0        0        0        0        0        0        0        0       56

             B          0     1     0        0        0        0        0        0        0        0        0       1                                                                                  

AM106627     A         52     0     0        0        0        0        0        0        0        0        0       52   

             C          0     1     0        0        0        0        0        0        0        0        0       1   

             D          0     1     0        0        0        0        0        0        0        0        0       1     

I tried to use the option LIST but this is not what I want. I need a table like above, where I have data displayed in a matrix form.

Is there a possibility to create such a table?   

Thanks!!                                                                                     

1 ACCEPTED SOLUTION

Accepted Solutions
Vince28_Statcan
Quartz | Level 8

Here's the link to my original question with Ballardw's responses

https://communities.sas.com/thread/48565

View solution in original post

3 REPLIES 3
Vince28_Statcan
Quartz | Level 8

As far as I am aware, or at least this is how I've done it for my projects,

the only alternative when you dislike the output layout of proc freq LIST for nway contingency tables is to use proc tabulate.

I will try to find a link to it. I had posted a similar question and Ballardw had provided a very helpful response as to how to write proc tabulate to generate the nway effect. Otherwise, I simply recommend you start by reading the sas documentation about it and come back with additionnal questions on how to code the proc tabulate to achieve your output.

Vincent

Vince28_Statcan
Quartz | Level 8

Here's the link to my original question with Ballardw's responses

https://communities.sas.com/thread/48565

Kafi
Calcite | Level 5

Thank you, that's what I was looking for!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1240 views
  • 0 likes
  • 2 in conversation