cancel
Showing results for 
Search instead for 
Did you mean: 

How do I output headers for categories with missing data?

SOLVED
Benbo123321
Calcite | Level 5
Solved!

How do I output headers for categories with missing data?

I'm trying to use PROC TABULATE to calculate counts and amounts for a set of months for a set of data.  Some commands may not appear in all months.  The problem is that SAS EG 5.1 by default does not print out headers for missing data and I need all the Commands printed out that occurred in that year, regardless of whether they occurred in that month.   I tried to use the PRINTMISS command after the TABLE statement, to no avail.


PROC TABULATE

   DATA = BENDATA;

       VAR AMOUNT;

   CLASS MONTH / ORDER= UNFORMATTED MISSING;

   CLASS COMMAND / ORDER = UNFORMATTED MISSING;

     TABLE MONTH * COMMAND,

                  AMOUNT * N PRINTMISS ;

;

RUN;

QUIT;

I get an error that says:  "That type of name (PRINTMISS) is unknown."

What is the workaround for this in SAS EG 5.1?

Thanks,
Ben

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User
Solution

Re: How do I output headers for categories with missing data?

The PRINTMISS error is occurring because you are missing a / to indicate non- page/row/column options.

One way IF you know there is a limited and not constantly changing list of commands is to create a custom format that is not very exciting:

proc format;

     value $command   /* assuming it is character*/

"Command1" = "Command1"

"Command2" = "Command2"

<continue>

;

run;

Then in proc tabulate add PRELOADFMT to the options for the command variable and

format command $command. ; to use the Command format.

View solution in original post

7 REPLIES 7
Steelers_In_DC
Barite | Level 11

Re: How do I output headers for categories with missing data?

I would add a dummy id before this step, populate 'A' or 1 for each variable.  Then after this step you can run another step that deletes your dummy id.:

Benbo123321
Calcite | Level 5

Re: How do I output headers for categories with missing data?

how would i go about doing that?  The code above is system generated using the UI.

Highlighted
Steelers_In_DC
Barite | Level 11

Re: How do I output headers for categories with missing data?

how many columns does BENDATA have?  If you provide a list of the columns and if they are character or numeric I'll show you the code.

Benbo123321
Calcite | Level 5

Re: How do I output headers for categories with missing data?

It has 3: Month, Command, and Amount. The first two are character, the last, numeric (?).  It is the summary count.

Ben

Benbo123321
Calcite | Level 5

Re: How do I output headers for categories with missing data?

To be clear; BENDATA has many columns.  The only ones I care about are the two above and the summary count on the AMOUNT variable.

ballardw
Super User
Solution

Re: How do I output headers for categories with missing data?

The PRINTMISS error is occurring because you are missing a / to indicate non- page/row/column options.

One way IF you know there is a limited and not constantly changing list of commands is to create a custom format that is not very exciting:

proc format;

     value $command   /* assuming it is character*/

"Command1" = "Command1"

"Command2" = "Command2"

<continue>

;

run;

Then in proc tabulate add PRELOADFMT to the options for the command variable and

format command $command. ; to use the Command format.

Benbo123321
Calcite | Level 5

Re: How do I output headers for categories with missing data?

thank you so much.  you solved my problem.