Is there an option that you can write in proc freq where we can only view the table only with values and not 0's
DRESS 1 | DRESS 2 | DRESS 3 | DRESS 4 | DRESS 5 | DRESS 6 | DRESS 7 | |
BLUE | 0 | 0 | 0 | 0 | 0 | 34 | 10 |
YELLOW | 0 | 0 | 0 | 6 | 0 | 0 | 0 |
PINK | 0 | 0 | 0 | 0 | 0 | 18 | 0 |
RED | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
GREEN | 0 | 5 | 0 | 0 | 0 | 427 | 79 |
PURPLE | 0 | 0 | 0 | 12 | 0 | 3 | 63 |
One way is to use a different procedure. You did not show any actual Proc Freq code to give variables or options but a basic cross table can be done such as
proc tabulate data=sashelp.class; class sex age; table sex, age *n='' /misstext=' '; run;
The n=' ' just suppresses a default column heading of N for the count.
The table option of misstext=' ' says to display a blank for missing values. The 0 in proc freq comes from a missing combination.
Does this mean that dress 1, 3 and 5 should be omitted?
What I would like is below, but I don't think its as easy as I thought.
DRESS 6 | DRESS 7 | ||
BLUE | 34 | 10 | |
DRESS 4 | |||
YELLOW | 6 | ||
DRESS 6 | |||
PINK | 18 | ||
DRESS 2 | DRESS 6 | DRESS 7 | |
GREEN | 5 | 427 | 79 |
DRESS 4 | DRESS 6 | DRESS 7 | |
PURPLE | 12 | 3 | 63 |
One way is to use a different procedure. You did not show any actual Proc Freq code to give variables or options but a basic cross table can be done such as
proc tabulate data=sashelp.class; class sex age; table sex, age *n='' /misstext=' '; run;
The n=' ' just suppresses a default column heading of N for the count.
The table option of misstext=' ' says to display a blank for missing values. The 0 in proc freq comes from a missing combination.
thank you, but I think I my have not explained my problem well enough
I just added a proc freq, table /list
that gave me a concise table that looks like this, without the 0's
Foodbuy_SubCategory | Manufacturer | Frequency | Cumulative Frequency |
Beef Boxed | Maple Leaf | 2 | 2 |
Beef Boxed Cooked | Hospital Food Services (HFS) | 2 | 4 |
Beef Brisket | Erie Meat Products | 3 | 7 |
Beef Brisket | Lesters Foods | 212 | 219 |
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.