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
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.
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.:
how would i go about doing that? The code above is system generated using the UI.
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.
It has 3: Month, Command, and Amount. The first two are character, the last, numeric (?). It is the summary count.
Ben
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.
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.
thank you so much. you solved my problem.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.