<?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 Changing reference level for categorical variable in PROC SURVEYREG in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-PROC/m-p/56740#M15881</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm trying to change the reference level for categorical variable in proc surveyreg.&amp;nbsp; Let's say I have the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc surveyreg data = temp;&lt;/P&gt;&lt;P&gt;weight weightvar;&lt;/P&gt;&lt;P&gt;strata stratum;&lt;/P&gt;&lt;P&gt;cluster psu;&lt;/P&gt;&lt;P&gt;class race;&lt;/P&gt;&lt;P&gt;model income = race /solution;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say that class is a four-level categorical variable with race = 1 being white, race = 2 being black, race = 3 being Asian, race = 4 being Hispanic.&amp;nbsp; It seems like proc surveyreg will use the highest value of race (race = 4, Hispanic) as the default baseline, but I'd like to set the default to be another level (say, race = 2 or black).&amp;nbsp; How do I do this without recoding my race variable?&amp;nbsp; [I could do a descending sort of race and include the option "order = data" on the proc surveyreg line, but that would only help me if I wanted to make race = 1 my baseline].&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Aug 2011 18:32:27 GMT</pubDate>
    <dc:creator>chuakp</dc:creator>
    <dc:date>2011-08-29T18:32:27Z</dc:date>
    <item>
      <title>Changing reference level for categorical variable in PROC SURVEYREG</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-PROC/m-p/56740#M15881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm trying to change the reference level for categorical variable in proc surveyreg.&amp;nbsp; Let's say I have the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc surveyreg data = temp;&lt;/P&gt;&lt;P&gt;weight weightvar;&lt;/P&gt;&lt;P&gt;strata stratum;&lt;/P&gt;&lt;P&gt;cluster psu;&lt;/P&gt;&lt;P&gt;class race;&lt;/P&gt;&lt;P&gt;model income = race /solution;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say that class is a four-level categorical variable with race = 1 being white, race = 2 being black, race = 3 being Asian, race = 4 being Hispanic.&amp;nbsp; It seems like proc surveyreg will use the highest value of race (race = 4, Hispanic) as the default baseline, but I'd like to set the default to be another level (say, race = 2 or black).&amp;nbsp; How do I do this without recoding my race variable?&amp;nbsp; [I could do a descending sort of race and include the option "order = data" on the proc surveyreg line, but that would only help me if I wanted to make race = 1 my baseline].&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Aug 2011 18:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-PROC/m-p/56740#M15881</guid>
      <dc:creator>chuakp</dc:creator>
      <dc:date>2011-08-29T18:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Changing reference level for categorical variable in PROC SURVEYREG</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-PROC/m-p/56741#M15882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The PROC SURVEYREG documentation talks about using formatted value and using the ORDER= options on the SURVEYREG statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do this two ways:&lt;/P&gt;&lt;P&gt;- change the value in the dataset itself, or&lt;/P&gt;&lt;P&gt;- use proc format tricks. e.g., your data is rece = '1','2','3','4', '4' would be used by default as you noted.&amp;nbsp; Suppose you want to use '3' as reference class, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value $race &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '1' = 'A White'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '2' = 'B Black'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '3' = 'D Asian'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '4' = 'C Hispanic'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc surveyreg order=formatted data=temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class race;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format race $race.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'3' would be used as reference because its formatted value is sorted the highest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SURVEYLOGISTIC, on the other hand, allows you explicit control over the reference class.&amp;nbsp; Here's a link to a paper showing examples &lt;A href="http://www2.sas.com/proceedings/sugi31/140-31.pdf"&gt;http://www2.sas.com/proceedings/sugi31/140-31.pdf&lt;/A&gt;.&amp;nbsp; This is probably not supported by SURVEYREG though (I can't test at the moment). &lt;/P&gt;&lt;DIR&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;P align="left"&gt;PROC SURVEYLOGISTIC DATA=ALL(WHERE=(20&amp;lt;=RIDAGEYR)) ; &lt;/P&gt;&lt;P align="left"&gt;CLUSTER SDMVPSU; STRATA SDMVSTRA; &lt;/P&gt;&lt;P align="left"&gt;&lt;STRONG&gt;CLASS SEX(ref='M') AGE1(ref=FIRST) RACE(ref='Non-Hispanic White'); &lt;/STRONG&gt;&lt;/P&gt;&lt;P align="left"&gt;WEIGHT WTMEC4YR; &lt;/P&gt;&lt;P align="left"&gt;MODEL HIGHTC(EVENT='1') = SEX AGE1 RACE ; &lt;/P&gt;&lt;P&gt;RUN; &lt;/P&gt;&lt;/SPAN&gt;&lt;/DIR&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Aug 2011 20:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-PROC/m-p/56741#M15882</guid>
      <dc:creator>DLing</dc:creator>
      <dc:date>2011-08-29T20:56:47Z</dc:date>
    </item>
    <item>
      <title>Changing reference level for categorical variable in PROC SURVEYREG</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-PROC/m-p/56742#M15883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for the tip on playing with the formats - that did the trick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Aug 2011 22:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-PROC/m-p/56742#M15883</guid>
      <dc:creator>chuakp</dc:creator>
      <dc:date>2011-08-29T22:37:27Z</dc:date>
    </item>
  </channel>
</rss>

