Here is the sample data and proc tabulate process, the results show as follows table A1. I need all those formats in proc format to be shown in final table as table A2. Is anyone know how to do it? I need some help. Thanks a lot.
data race;
input race ;
cards;
1
1
1
2
2
2
3
3
3
4
4
4
run;
proc format;
value race 0 = '00 race0'
1 = '01 race1'
2 = '02 race2'
3 = '03 race3'
4 = '04 race4'
5 = '05 race5';
run;
proc tabulate data=race order=formatted;
class race;
format race race.;
table race,n;
run;
table A1
race | N |
01 race1 | 3 |
02 race2 | 3 |
03 race3 | 3 |
04 race4 | 3 |
table A2
race | N |
00 race0 | 0 |
01 race1 | 3 |
02 race2 | 3 |
03 race3 | 3 |
04 race4 | 3 |
05 race5 | 0 |
Use options missing = 0, and the preloadfmt and printmiss options:
options missing = 0;
proc tabulate data=race order=formatted;
class race / preloadfmt;
format race race.;
table race,n / printmiss;
run;
Use options missing = 0, and the preloadfmt and printmiss options:
options missing = 0;
proc tabulate data=race order=formatted;
class race / preloadfmt;
format race race.;
table race,n / printmiss;
run;
Thank you so much!!! LOL
Mind that I'm not a proc tabulate maven, but just followed Maxim #1.
Thanks Kurt, I just read Maxim 1- 48 three times. It helps a lot. I think i really need pay much more attention on the documentations. Here is another question, If you find a problem how do you locate the keywords in documents? Ctrl+F?
Yes. But it's always good to study the whole page when you're already there. You might find other helpful options that make your work easier.
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.