Hello, I am trying to perform a Difference-in-Difference analysis using Proc Genmod. My goal is to get a DID estimate and 95%CI comparing the relative risk of outcome X from baseline (period = 0) to 0-3 months post (period = 1) of the exposed group to that same RR of the unexposed group. I would like the analysis to also output DID estimates (Exposed vs. Unexposed) for the RRs for 3-6, 6-9, and 9-12 months post (period = 2, 3, 4). An example of my data is below:
ID | exposed | period | outcomeX |
1 | 0 | 0 | 0 |
1 | 0 | 2 | 1 |
2 | 1 | 1 | 0 |
3 | 0 | 2 | 0 |
3 | 0 | 3 | 0 |
3 | 0 | 4 | 0 |
4 | 1 | 2 | 1 |
My question is how do I best get Proc Genmod to output the DID estimate and 95%CI for RRexposed (exposed period0 vs exposed period1) Vs RRunexposed (unexposed period0 vs unexposed period1)? My current model below uses the SLICE statement to compare all levels of period for each exposure category, however I’m not sure if this gives me what I need since it outputs two tables, each with the exposed variable held constant (i.e., no comparison between exposure groups). Is there a way to get the DID estimate using ESTIMATE statements?
PROC GENMOD DATA = have; CLASS ID exposed (ref=0) period (ref=0); MODEL outcomeX (event='1') = period exposed period*exposed /dist=poisson link=log type3; REPEATED SUBJECT = ID / TYPE = cs; WEIGHT atewgt; SLICE period*exposed / sliceby=exposed diff exp cl adjust=bon; RUN;
http://support.sas.com/kb/61/830.html
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.