Hello All! Learning SAS user back again. I'm working with ecological data, and (thanks to the SAS community!!!) successfully used code that counts the number of events across three variables (year, sex, age_group). The data is all events, so there are no "zeros" in the original data set. Now, I need to either generate zeros for the missing groups that do not have events or merge a data set that has "zeros" using a conditional statement. My final intent is to obtain rates using PROC GENMOD employing a nb or zero-inflated model. All that said, I'm uncertain as to how to generate or create the zeros in the sql data set for my final analysis. Code to create the count: proc sql; create table work.sql as select year, sex, age_group, count(*) as count from one group by year, sex, age_group ; quit; Variables: year, site, sex=1 or 2, age_group=1, 2, or 3 Sample sql data set: year site sex age_group counts 2003 66 2 3 11 2003 66 2 3 21 2003 66 2 2 17 2003 66 1 1 3 2003 66 1 2 1 As you likely see, there are no counts or "zeros" for age_groups 1 and 2 where sex=2 and so on. Thank you for all of your help!
... View more