The SAS Output Delivery System and reporting techniques

Proc tabulate shown with all formats???

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

Proc tabulate shown with all formats???

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

raceN
01 race13
02 race23
03 race33
04 race43

 

table A2

raceN
00 race00
01 race13
02 race23
03 race33
04 race43
05 race50

Accepted Solutions
Solution
‎11-27-2017 03:14 AM
Super User
Posts: 8,302

Re: Proc tabulate shown with all formats???

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;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎11-27-2017 03:14 AM
Super User
Posts: 8,302

Re: Proc tabulate shown with all formats???

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;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 9

Re: Proc tabulate shown with all formats???

Posted in reply to KurtBremser

Thank you so much!!! LOL

Super User
Posts: 8,302

Re: Proc tabulate shown with all formats???

Mind that I'm not a proc tabulate maven, but just followed Maxim #1.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 9

Re: Proc tabulate shown with all formats???

Posted in reply to KurtBremser

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? 

Super User
Posts: 8,302

Re: Proc tabulate shown with all formats???

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 223 views
  • 3 likes
  • 2 in conversation