<?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: proc mixed contrast statements difference in difference approach in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/769167#M37616</link>
    <description>&lt;P&gt;Because your model has the covariate TIME, you essentially are fitting a regression model for different groups. For your DID request, you need to specify the TIME value. At what TIME value do you want this DID?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 13:46:00 GMT</pubDate>
    <dc:creator>jiltao</dc:creator>
    <dc:date>2021-09-22T13:46:00Z</dc:date>
    <item>
      <title>proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768654#M37588</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm running into some trouble trying to figure out contrast statements with proc mixed. I'm attempting a difference-in-difference model to compare proportions between hispanic/latino and non-hispanic/latino given an event that occurs. I'm trying to contrast or compare the gap pre intervention vs post intervention between hispanic and non-hispanic, I believe the best way to accomplish this is through the use of a contrast statement?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Shad_0-1632168121280.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63752i9E37476EC933BB93/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Shad_0-1632168121280.png" alt="Shad_0-1632168121280.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Figure. to illustrate what I'm trying to compare (ie the gap between orange and blue line pre-intervention to the gap between orange and blue lines post-intervention).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data hisp1; 
	input Hispanic time COVID percent_perf;
	datalines;
1 0 0 33.3333
1 1 0 36.0172
1 2 0 34.9497
1 3 0 38.1514
1 4 0 35.0831
1 5 1 38.587
1 6 1 39.7946
1 7 1 37.7932
1 8 1 39.0023
1 9 1 35.4019
0 0 0 31.5364
0 1 0 31.0515
0 2 0 30.2232
0 3 0 32.5556
0 4 0 32.3446
0 5 1 33.6667
0 6 1 33.3706
0 7 1 29.8397
0 8 1 32.5166
0 9 1 29.5235
;
run;

  PROC MIXED DATA = hisp1 METHOD=ML
 PLOTS(MAXPOINTS=60000)=(RESIDUALPANEL(UNPACK) VCIRYPANEL(UNPACK));
 CLASS  Hispanic (ref="0") COVID (ref="0") ;
 MODEL percent_perf = time COVID COVID*time Hispanic Hispanic*time Hispanic*COVID Hispanic*COVID*time/ S ;
 REPEATED intercept / TYPE = UN R;

 RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 20:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768654#M37588</guid>
      <dc:creator>Shad</dc:creator>
      <dc:date>2021-09-20T20:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768898#M37600</link>
      <description>&lt;P&gt;What variable gives you the pre- or post-intervention information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How is this repeated measures data? Do you have two subjects in the data, each with 10 measurements?&lt;/P&gt;
&lt;P&gt;I can help you with an ESTIMATE/CONTRAST statement to test difference in difference, but you might want to first to make sure your model is reasonable for your data.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Jill&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 17:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768898#M37600</guid>
      <dc:creator>jiltao</dc:creator>
      <dc:date>2021-09-21T17:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768900#M37601</link>
      <description>&lt;P&gt;Hi Jill! Thanks for the response. I actually simplified the data/model specification to post here since I wasn't quite sure how to best share a sample of the data set with all the subjects included.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; PROC MIXED DATA = new3 METHOD=ML PLOTS(MAXPOINTS=60000)=(RESIDUALPANEL(UNPACK) VCIRYPANEL(UNPACK));
 	CLASS  hospital_number race (ref="2") COVID (ref="0");
 	MODEL percent_perf = time COVID COVID*time race race*time race*COVID race*COVID*time/ S ;
 	REPEATED  / subject = hospital_number TYPE = ar(1) R;
 RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My data is actually at the hospital level, so I have observations for each hospital at quarterly intervals. The "intervention" is the variable COVID (0 - denoting a time period before the pandemic, 1 - denotes a period after).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully that clarifies it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 17:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768900#M37601</guid>
      <dc:creator>Shad</dc:creator>
      <dc:date>2021-09-21T17:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768932#M37602</link>
      <description>&lt;P&gt;Thanks for the info!&lt;/P&gt;
&lt;P&gt;So you are fitting an ANCOVA model. Do you want the DID for the intercept or the slope? I will provide both below --&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;PROC MIXED DATA = new3 METHOD=ML PLOTS(MAXPOINTS=60000)=(RESIDUALPANEL(UNPACK) VCIRYPANEL(UNPACK));
 	CLASS  hospital_number race (ref="2") COVID (ref="0");
 	MODEL percent_perf = time COVID COVID*time race race*time race*COVID race*COVID*time/ S ;
 	REPEATED  / subject = hospital_number TYPE = ar(1) R;
    estimate 'DID for race*covid when time=0' race*covid 1 -1 -1 1;
    estimate 'DID for the slopes between race*covid' race*covid*time 1 -1 -1 1;
 RUN;&lt;/LI-CODE&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Jill&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 19:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768932#M37602</guid>
      <dc:creator>jiltao</dc:creator>
      <dc:date>2021-09-21T19:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768966#M37609</link>
      <description>&lt;P&gt;Thanks Jill!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure that's exactly what I'm trying to estimate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    estimate 'DID for race*covid when time=0' race*covid 1 -1 -1 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I understand this correctly, this would be the estimated mean "jump" in the outcome at the interruption between races. Essentially Beta 6 in the model output (race*covid). Which checks out when comparing the estimate with the model output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    estimate 'DID for the slopes between race*covid' race*covid*time 1 -1 -1 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Similarly, isn't this the estimated difference in slopes after the interruption between races, or B7 time*race*covid.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps, I'm being silly and that is already explained by the model output. But how would I go about comparing the&amp;nbsp; interruption periods, ie is the gap between races pre-interruptions significantly wider or smaller compared to after the interruption?&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>Tue, 21 Sep 2021 22:19:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/768966#M37609</guid>
      <dc:creator>Shad</dc:creator>
      <dc:date>2021-09-21T22:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/769167#M37616</link>
      <description>&lt;P&gt;Because your model has the covariate TIME, you essentially are fitting a regression model for different groups. For your DID request, you need to specify the TIME value. At what TIME value do you want this DID?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 13:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/769167#M37616</guid>
      <dc:creator>jiltao</dc:creator>
      <dc:date>2021-09-22T13:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/769357#M37618</link>
      <description>&lt;P&gt;That TIME variable is the piece of the estimate statement that I think I find the most confusing. If I wanted to get the estimate for each TIME would I just add one to the estimate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;estimate 'DID for the slopes between race*covid time = 0' race*covid*time 1 -1 -1 1;
estimate 'DID for the slopes between race*covid time = 1' race*covid*time 1 -1 -1 2;&lt;BR /&gt;estimate 'DID for the slopes between race*covid time = 2' race*covid*time 1 -1 -1 3;&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;estimate 'DID for the slopes between race*covid time = N' race*covid*time 1 -1 -1 N;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks for your help!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 16:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/769357#M37618</guid>
      <dc:creator>Shad</dc:creator>
      <dc:date>2021-09-22T16:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/769380#M37619</link>
      <description>&lt;P&gt;It does not make sense to compare slopes for a specific time point. You might want to compare the expected response value between different groups at a certain time point. Below&amp;nbsp;are some ESTIMATE statements you might find helpful --&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;estimate 'DID for race*covid at time = 0' race*covid 1 -1 -1 1;
estimate 'DID for race*covid at time = 1' race*covid 1 -1 -1 1 race*covid*time 1 -1 -1 1;
estimate 'DID for race*covid at time = 2' race*covid 1 -1 -1 1 race*covid*time 2 -2 -2 2;
&lt;/LI-CODE&gt;
&lt;P&gt;However, I am not sure if this makes practical sense -- do you have measurements at time 1 for post intervention? Or is it always times 0 to 4 for pre and times 5-9 for post? If so, you might want to reconsider your model specifications, considering what your analysis goal is.&lt;/P&gt;
&lt;P&gt;Jill&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 16:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/769380#M37619</guid>
      <dc:creator>jiltao</dc:creator>
      <dc:date>2021-09-22T16:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed contrast statements difference in difference approach</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/770301#M37640</link>
      <description>&lt;P&gt;The OP might also wish to consider using a generalized linear (mixed) model, since the response variable is a proportion.&amp;nbsp; GENMOD or GLIMMIX seem more appropriate, depending on the need for marginal or conditional means/errors and on the inference space to be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 17:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-contrast-statements-difference-in-difference-approach/m-p/770301#M37640</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2021-09-24T17:01:17Z</dc:date>
    </item>
  </channel>
</rss>

