Usage Note 23846: How to include values in PROC TABULATE output that do not exist in the data
The TABULATE procedure prints headings only for values that appear in the input data set. If you want to include headings for all possible values, you have two different ways to create such a table:
- Use the PRELOADFMT option in the CLASS statement with the PRINTMISS option in the TABLE statement:
data test;
input dayofweek $10. @12 sales 5.;
datalines;
monday 10000
tuesday 20000
thursday 15000
friday 12000
;
run;
proc format;
value $weekd (notsorted) 'monday'='Monday'
'tuesday'='Tuesday'
'wednesday'='Wednesday'
'thursday'='Thursday'
'friday'='Friday';
run;
proc tabulate data=test order=data;
class dayofweek /preloadfmt ;
format dayofweek $weekd.;
var sales;
table dayofweek all, sales all / printmiss misstext='0';
run;
- Use the CLASSDATA= and EXCLUSIVE options in the PROC TABULATE statement:
data test;
input dayofweek $10. @12 sales 5.;
datalines;
monday 10000
tuesday 20000
thursday 15000
friday 12000
;
run;
data classdata;
input dayofweek $10.;
datalines;
monday
tuesday
wednesday
thursday
friday
;
run;
proc tabulate data=test classdata=classdata exclusive order=data;
class dayofweek;
var sales;
table dayofweek all, sales all / misstext='0';
run;
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | SAS Reference ==> Procedures ==> TABULATE
|
Date Modified: | 2008-05-19 09:59:35 |
Date Created: | 2004-03-11 10:16:15 |