BookmarkSubscribeRSS Feed
newsas007
Quartz | Level 8

Hi all, 

I am trying to get a formatted frequency table and I tried PROC freq and tabulate but i can't seem to figure it out. Here is my dataset: I will need the output in a 3 dimensional table. I only need the count and respective totals and in the specific format as shown below.

Thanks,

Item Code Category
A H Tar
B H IO
C L End
D L IO
A H End
B H Tar
C H IO
D L End
A L IO
B L End
C H Tar
A L IO
B H End
C L IO
D H End

 

Want:

Item Code Tar IO End Total
A          
  H 1   1 2
  L   2   2
B          
  H 1 1 1 3
  L     1 1
C          
  H 1 1   2
  L   1 1 2
D          
  H     1 1
  L   1 1 2
Total   3 6 6 15
4 REPLIES 4
ballardw
Super User

Totals of what? I don't see anything to total. Do you mean count?

 

When specifying a "must look like this" you really should place the values you need in the body of the example table from the example data. Otherwise you get lots of guesses as to what might work.

newsas007
Quartz | Level 8
Sorry: I have edited the table with numbers. Hope this makes more sense now.
Cynthia_sas
Diamond | Level 26

Hi:

  Both PROC REPORT and PROC TABULATE will create this type of table for you. There are other procedures, as well but the report format would be slightly different (PROC MEANS). You could do more cosmetic tweaking and ordering once you're comfortable with the procedures.

Cynthia_sas_0-1610125478043.png

 

 

Cynthia

newsas007
Quartz | Level 8
Hi @Cynthia_sas,
This works! Thanks so much. The cosmetic tweaking and ordering is tricky and i am trying to learn. Thanks again!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1200 views
  • 0 likes
  • 3 in conversation