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!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.