The SAS Output Delivery System and reporting techniques

populating zero's in a tabulate

Not applicable
Posts: 0

populating zero's in a tabulate

Is this possible? I am running a tabulate that then creates a table using ods. In the tabulate (and therefore the output table) I want to see all possible combinations of variables, even if the total is zero. So I want to ensure that all possible row and column headings are in the tabulate, even if they contain no data and where the data does not exist I want the table to contain a zero not a period.

Is this easy? I've been trying to use printmiss and preloadfmt but I don't know the syntax and can't seem to find any non-confusing online resource.

This is an example of my tabulate so far:

proc tabulate data=dataset;
class char1 char2;
var values;
table char1, char2*values / printmiss;
ods output table=fred;

Where do I put the preloadfmt or am I chasing a red herring up the wrong tree again?
Super Contributor
Posts: 297

Re: populating zero's in a tabulate

Posted in reply to deleted_user
add misstext='0' to the options section of the tabulate statement, i.e. with the printmiss option.
Posts: 9,365

Re: populating zero's in a tabulate

Posted in reply to deleted_user
PRINTMISS goes on the TABLE statement, after a slash and PRELOADFMT goes on the CLASS statement for the CLASS variable whose format should be loaded. And then, of course, you need to make sure the format is assigned by having a FORMAT statement in the program (or by making surethe format is permanently assigned). This Tech Support note has some nice sample code:

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation