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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.