<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Difference-in-Difference analysis binary outcome in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805516#M39619</link>
    <description>&lt;P&gt;If your response is binary, then it is not advisable to use a linear probability model assuming the response is normally distributed. A difference in difference analysis appropriate for a binary response is discussed and illustrated in &lt;A href="http://support.sas.com/kb/61830" target="_self"&gt;this note&lt;/A&gt;. This uses a logistic model and the DID is computed using a macro such as the NLMeans macro.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Apr 2022 14:53:51 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2022-04-01T14:53:51Z</dc:date>
    <item>
      <title>Difference-in-Difference analysis binary outcome</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805504#M39617</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm conducting a &lt;STRONG&gt;difference in difference analysis&lt;/STRONG&gt; for the first time. My aim is to compare the proportion of preterm deliveries (in a dataset of deliveries, 1 line per delivery) before and after a policy change. The control group are deliveries during the same time period in a year during which no policy change has happened. I do not expect any confounders so propensity scores or adjusting are not planned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to conduct a linear probability model to quantify the difference of the difference of the probability of preterm delivery between the two years with a robust 95% CI (because one mum could potentially contribute several deliveries to the dataset).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset is structured as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exposed=1 if delivery in year of policy change, 0 if delivery in year without policy change&lt;/P&gt;&lt;P&gt;Post=1 if delivery after date of policy change, 0 if delivery before date of policy change&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MumID Preterm Exposed Post&lt;/P&gt;&lt;P&gt;1 0 1 0&lt;/P&gt;&lt;P&gt;2 1 1 0&lt;/P&gt;&lt;P&gt;3 1 0 1&lt;/P&gt;&lt;P&gt;4 0 0 1&lt;/P&gt;&lt;P&gt;5 0 1 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found the following code which seems to run. However, given I have not done this analysis before I'm unsure if I've implemented it correctly.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc surveyreg data=dataset;
cluster mumid; *I assume this calculates robust 95% CI by accounting for same Mumid;
class post exposed;
model preterm= post exposed post*exposed / CLPARM solution vadjust=none;
estimate "Diff in Diff" post*exposed 1 -1 -1 1;
lsmeans post*exposed;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;Does 'cluster mumid' indicate to calculate robust 95% CI?&lt;/FONT&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I got the following preliminary output&amp;nbsp; (sorry in German) and I'm wondering if I'm interpreting this right:&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022.04.01_SAS output DID for sas forum.PNG" style="width: 738px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70025iA1570495B888C58F/image-size/large?v=v2&amp;amp;px=999" role="button" title="2022.04.01_SAS output DID for sas forum.PNG" alt="2022.04.01_SAS output DID for sas forum.PNG" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class="lia-align-left" align="center"&gt;&lt;SPAN&gt;I interpret this such that: &lt;/SPAN&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;the unexposed group (year without intervention) had 6.5% preterms prior to the policy change. &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;The exposed group (year of policy change) had 0.1% more preterms prior to the policy change.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;I'm not sure how to interpret post 0 = &lt;SPAN&gt;-0.0063864. Is this the average change between pre and post policy change?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;I interpreted the interaction term as my main result: i.e. that the difference of the difference in the proportion of preterm deliveries between the two years is 0.4/100 deliveries, which is not statistically significant (p=0.203). So the policy change did not significantly change the proportion of preterm deliveries.&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;P&gt;Any insight into whether I'm reading this correctly or how to improve my code is appreciated, as I have not done this before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Julia&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 13:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805504#M39617</guid>
      <dc:creator>jspoend</dc:creator>
      <dc:date>2022-04-01T13:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Difference-in-Difference analysis binary outcome</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805516#M39619</link>
      <description>&lt;P&gt;If your response is binary, then it is not advisable to use a linear probability model assuming the response is normally distributed. A difference in difference analysis appropriate for a binary response is discussed and illustrated in &lt;A href="http://support.sas.com/kb/61830" target="_self"&gt;this note&lt;/A&gt;. This uses a logistic model and the DID is computed using a macro such as the NLMeans macro.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 14:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805516#M39619</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-04-01T14:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Difference-in-Difference analysis binary outcome</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805798#M39635</link>
      <description>Hi StatDave,&lt;BR /&gt;Thanks a lot for your answer. I have thought about that too. However, I'veread that using linear models to quantify absolute risk differences is an option. E.g. here:.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.statalist.org/forums/forum/general-stata-discussion/general/1408193-binary-dependent-variable-in-difference-in-difference-method" target="_blank"&gt;https://www.statalist.org/forums/forum/general-stata-discussion/general/1408193-binary-dependent-variable-in-difference-in-difference-method&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;But am definitely no expert. The problem is that the output is harder to interpret if I use logistic regression, as I want to quantify simple absolute risk differences. As far as I understand I cant get those with proc logistic?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot.</description>
      <pubDate>Mon, 04 Apr 2022 07:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805798#M39635</guid>
      <dc:creator>jspoend</dc:creator>
      <dc:date>2022-04-04T07:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Difference-in-Difference analysis binary outcome</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805849#M39636</link>
      <description>&lt;P&gt;If you use the Margins macro to fit the model and do the comparisons as shown in the note I referred to, the interpretation is fairly straightforward. In the binary example in the note, the difference in the two A levels is given at each B level in the "Contrasts of A B Margins" table. As can be seen there, the A1-A0 difference in B=1 is 0.53-0.46 = 0.07. So, the probability of the event (Y=1) increases by 0.07 in that level of B when you increase A from 0 to 1. Similarly, the A1-A0 difference in B=0 is 0.72-0.39 = 0.33, meaning that the event probability increases by 0.33 when you increase A in level 0 of B. The difference in these two probability differences is 0.07-0.33 = -0.26 which indicates that the event probability change in B=1 is 0.26 smaller than the probability change in B=0. This is a measure of the interaction between A and B on the event probability. If the change in the event probability in the two B levels were the same, then there would be no interaction.&amp;nbsp;The tests of all of these differences are significant as shown in the Pr&amp;gt;ChiSq column. You could, of course, report these differences as percent changes if you prefer.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 13:34:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Difference-in-Difference-analysis-binary-outcome/m-p/805849#M39636</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-04-04T13:34:09Z</dc:date>
    </item>
  </channel>
</rss>

