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 |
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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.