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
SAS Super FREQ

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!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 742 views
  • 0 likes
  • 3 in conversation