<?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 How to get stratified odds ratios against one reference level for each interaction term in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-get-stratified-odds-ratios-against-one-reference-level/m-p/739939#M35947</link>
    <description>&lt;P&gt;I'm running a logistic regression model with main effects and two interaction terms. Both interaction terms in the model (ageten*education and ageten*homeown) were significant (p&amp;lt;0.05) and I wanted to have stratified odds ratios with one reference group (40-49 &amp;amp; post-secondary education, 40-49 &amp;amp; owned home) for each interaction.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Code 1:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;proc surveylogistic data=survey.family; /* model with both interactions */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;weight wt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;class ageten (ref='40-49') sex (ref='Male') state (ref='Florida')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;income (ref='Above LIM') homeown (ref='Owned') education (ref='Post-secondary')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;race (ref='White') immigration (ref='Non-immigrant')/ param = glm;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;model outcome(event='A') = ageten sex state income homeown education race immigration age*education age*homeown/ expb clodds nodummyprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;However, when I include expb in the code 1, I get odds ratios where the reference group is different for each stratum. For example, the reference group for '10-19 year old living in a rented home' is '10-19 year old living in owned home' and the reference group for '20-29 year old living in rented home' is '20-29 year old living in owned home'.&lt;BR /&gt;&lt;BR /&gt;I've also tried combining the variables involved in the interaction into a single variable (shown in code 2 below), however there seems to be problems with multicollinearity if age is included in both interactions. I was able to get the stratified odds with only one reference group in a model controlling for other sociodemographic characteristics, but I had to have a separate model for each interaction/combined variable. Also, I assume that doing it this way means I wouldn't be able to include the two individual variables in the model.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Code 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;/* Ageten_homeown interaction coding */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;data survey.family; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;set survey.family;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;if ageten=4 and homeown=1 then agehome=0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=1 and homeown=1 then agehome=1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=2 and homeown=1 then agehome=2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=3 and homeown=1 then agehome=3;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=1 and homeown=2 then agehome=4;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=2 and homeown=2 then agehome=5;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=3 and homeown=2 then agehome=6;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=4 and homeown=2 then agehome=7;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;proc format;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;value agehome 0='40-49 owned' 1='10-19 owned' 2='20-29 owned' &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;3='30-39 owned' 4= '10-19 rented' 5='20-29 rented' 6='30-39 rented' 7='40-49 rented';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;proc surveylogistic data=survey.family;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;class&amp;nbsp; agehome (ref='40-49 owned')&amp;nbsp;sex (ref='Male') state (ref='Florida') education (ref='Post-secondary')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;income (ref='Above LIM') race (ref='White') immigration (ref='Non-immigrant')/ param=ref;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;model outcome(event='A')= agehome sex state education income race immigration;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;weight wt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;title 'Interaction ageten*homeownership on outcome A in adjusted model';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;format agehome agehome.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;What I would like to generate are odds ratios for each combination compared to one single reference group (like 40-49 year old living in owned home). I'm hoping to get a table of odds ratios that looks like this for both significant interaction terms included in the same model that's adjusted for other characteristics:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="modelsss.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59156iE86B7620BFC9917F/image-size/large?v=v2&amp;amp;px=999" role="button" title="modelsss.png" alt="modelsss.png" /&gt;&lt;/span&gt;&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;&lt;P&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to produce odds ratios like that in the surveylogistic procedure? If not, is code 2 used for two models the best way to approach this? Thanks.&lt;/P&gt;</description>
    <pubDate>Sat, 08 May 2021 02:36:00 GMT</pubDate>
    <dc:creator>rjj0211</dc:creator>
    <dc:date>2021-05-08T02:36:00Z</dc:date>
    <item>
      <title>How to get stratified odds ratios against one reference level for each interaction term</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-get-stratified-odds-ratios-against-one-reference-level/m-p/739939#M35947</link>
      <description>&lt;P&gt;I'm running a logistic regression model with main effects and two interaction terms. Both interaction terms in the model (ageten*education and ageten*homeown) were significant (p&amp;lt;0.05) and I wanted to have stratified odds ratios with one reference group (40-49 &amp;amp; post-secondary education, 40-49 &amp;amp; owned home) for each interaction.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Code 1:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;proc surveylogistic data=survey.family; /* model with both interactions */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;weight wt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;class ageten (ref='40-49') sex (ref='Male') state (ref='Florida')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;income (ref='Above LIM') homeown (ref='Owned') education (ref='Post-secondary')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;race (ref='White') immigration (ref='Non-immigrant')/ param = glm;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;model outcome(event='A') = ageten sex state income homeown education race immigration age*education age*homeown/ expb clodds nodummyprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;However, when I include expb in the code 1, I get odds ratios where the reference group is different for each stratum. For example, the reference group for '10-19 year old living in a rented home' is '10-19 year old living in owned home' and the reference group for '20-29 year old living in rented home' is '20-29 year old living in owned home'.&lt;BR /&gt;&lt;BR /&gt;I've also tried combining the variables involved in the interaction into a single variable (shown in code 2 below), however there seems to be problems with multicollinearity if age is included in both interactions. I was able to get the stratified odds with only one reference group in a model controlling for other sociodemographic characteristics, but I had to have a separate model for each interaction/combined variable. Also, I assume that doing it this way means I wouldn't be able to include the two individual variables in the model.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Code 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;/* Ageten_homeown interaction coding */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;data survey.family; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;set survey.family;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;if ageten=4 and homeown=1 then agehome=0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=1 and homeown=1 then agehome=1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=2 and homeown=1 then agehome=2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=3 and homeown=1 then agehome=3;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=1 and homeown=2 then agehome=4;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=2 and homeown=2 then agehome=5;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=3 and homeown=2 then agehome=6;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;else if ageten=4 and homeown=2 then agehome=7;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;proc format;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;value agehome 0='40-49 owned' 1='10-19 owned' 2='20-29 owned' &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;3='30-39 owned' 4= '10-19 rented' 5='20-29 rented' 6='30-39 rented' 7='40-49 rented';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;proc surveylogistic data=survey.family;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;class&amp;nbsp; agehome (ref='40-49 owned')&amp;nbsp;sex (ref='Male') state (ref='Florida') education (ref='Post-secondary')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;income (ref='Above LIM') race (ref='White') immigration (ref='Non-immigrant')/ param=ref;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;model outcome(event='A')= agehome sex state education income race immigration;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;weight wt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;title 'Interaction ageten*homeownership on outcome A in adjusted model';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;format agehome agehome.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;What I would like to generate are odds ratios for each combination compared to one single reference group (like 40-49 year old living in owned home). I'm hoping to get a table of odds ratios that looks like this for both significant interaction terms included in the same model that's adjusted for other characteristics:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="modelsss.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59156iE86B7620BFC9917F/image-size/large?v=v2&amp;amp;px=999" role="button" title="modelsss.png" alt="modelsss.png" /&gt;&lt;/span&gt;&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;&lt;P&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to produce odds ratios like that in the surveylogistic procedure? If not, is code 2 used for two models the best way to approach this? Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 08 May 2021 02:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-get-stratified-odds-ratios-against-one-reference-level/m-p/739939#M35947</guid>
      <dc:creator>rjj0211</dc:creator>
      <dc:date>2021-05-08T02:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get stratified odds ratios against one reference level for each interaction term</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-get-stratified-odds-ratios-against-one-reference-level/m-p/740270#M35979</link>
      <description>&lt;P&gt;This can done with the LSMEANS or LSMESTIMATE statement. The easiest way is using the LSMEANS statement with the DIFF and ODDSRATIO options. The following statement will produce all of the pairwise odds ratios among the combinations of levels of the two predictors. You just need to pick out the ones you want among the entire set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;lsmeans ageten*homeown / diff oddsratio;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just want to limit it to just the specific ones you want, then use LSMESTIMATE statements to compute those specific ones. The coefficients in each statement match the combinations as ordered in the output from the LSMEANS statement. These statements would compute odds ratios comparing two particular combinations:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;lsmestimate diagnosis*treatment '1vs6' 1 0 0 0 0 -1 / exp;&lt;BR /&gt;lsmestimate diagnosis*treatment '2vs6' 0 1 0 0 0 -1 / exp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 20:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-get-stratified-odds-ratios-against-one-reference-level/m-p/740270#M35979</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-05-10T20:14:43Z</dc:date>
    </item>
  </channel>
</rss>

