SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
rcwill7
Calcite | Level 5

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; 

 

1 REPLY 1

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1147 views
  • 0 likes
  • 2 in conversation