Xia,
Yes, this works but it still give me output for all 12 months (CM) in 2014, even those that don't have any data in the dataset. My dataset has data for only the last three months of 2014 but the table output from the Tabulate procedure displays all 12 months of 2014. Is there some way to exclude columns in the output table where there are all zeros?
Thanks again for all your assistance!
Brian
Xia,
I think I figured out how to get what I want: I run the first Proc Tabulate with the PRINTMISS option that outputs all months for all sites. I store this in a table named TabData. I then delete all rows from TabData where the variable PctN_1011 equals ".". I then do another Proc Tabulate on this table as shown below.
title 'Monthly PPH by MTF';
proc tabulate data=Navy_PPIP_new missing out=tabdata;
class Site_ID PPH CY CM;
TABLE Site_ID * (PPH all) all, CY * CM * (N PCTN<PPH all>) all*(N PCTN<PPH all>) /printmiss MISSTEXT='0';
run;
Data temp;
set tabdata;
if PctN_1011 ne .;
run;
title 'Monthly PPH by MTF';
proc tabulate data=temp ;
class Site_ID PPH CY CM;
var N PctN_1011;
TABLE Site_ID * (PPH all) all, CY * CM * (N PctN_1011="PCTN") all*(N PctN_1011="PCTN") / MISSTEXT='0';
run;
I appreciate all your help. I couldn't have figured it out without it!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.