<?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 Not recognizing first level in categorical variable during logistic regression in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Not-recognizing-first-level-in-categorical-variable-during/m-p/708616#M9600</link>
    <description>&lt;P&gt;I am doing logistic regression using all categorical variables. When I create a 2x2 table of the outcome (casehyst_path) and the exposure (jointyears_cat), each level of jointyears_cat (0, 1, 2 and 3) all show up. But when I run the logistic regression, it ignores 0, and uses 1 as the reference, even though I specified ref=first. Here is my code, and I've attached screenshots of my results. Any help is appreciated! Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.adeno1;&lt;BR /&gt;set work.adenovar;&lt;BR /&gt;if jointyears = 0 or hash = 2 then jointyears_cat = "0";&lt;BR /&gt;if 0 LT jointyears LE 2 then jointyears_cat = "1";&lt;BR /&gt;if 2 LT jointyears LE 5 then jointyears_cat = "2";&lt;BR /&gt;else if jointyears GT 5 then jointyears_cat = "3";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.adenovar;&lt;BR /&gt;set work.adeno1;&lt;BR /&gt;if 20 LE refage LE 34 then refagecat = "0";&lt;BR /&gt;if 35 LE refage LE 39 then refagecat = "1";&lt;BR /&gt;if 40 LE refage LE 44 then refagecat = "2";&lt;BR /&gt;if 45 LE refage LE 49 then refagecat = "3";&lt;BR /&gt;if 50 LE refage LE 54 then refagecat = "4";&lt;BR /&gt;else if 55 LE refage LE 59 then refagecat = "5";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if 36 LE hashlage1 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage1 LE 35 then before35 = "1";&lt;BR /&gt;if 36 LE hashlage2 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage2 LE 35 then before35 = "1";&lt;BR /&gt;if 36 LE hashlage3 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage3 LE 35 then before35 = "1";&lt;BR /&gt;if 36 LE hashlage4 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage4 LE 35 then before35 = "1";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = work.adenovar;&lt;BR /&gt;where before35 = "1";&lt;BR /&gt;tables jointyears_cat*casehyst_path / norow nopercent;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title "hysterectomy controls age";&lt;BR /&gt;proc logistic data = adenovar descending;&lt;BR /&gt;where before35 = "1";&lt;BR /&gt;class jointyears_cat refagecat / param = ref ref = first;&lt;BR /&gt;model casehyst_path = jointyears_cat refagecat;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Dec 2020 18:18:34 GMT</pubDate>
    <dc:creator>gejoachim99</dc:creator>
    <dc:date>2020-12-29T18:18:34Z</dc:date>
    <item>
      <title>Not recognizing first level in categorical variable during logistic regression</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Not-recognizing-first-level-in-categorical-variable-during/m-p/708616#M9600</link>
      <description>&lt;P&gt;I am doing logistic regression using all categorical variables. When I create a 2x2 table of the outcome (casehyst_path) and the exposure (jointyears_cat), each level of jointyears_cat (0, 1, 2 and 3) all show up. But when I run the logistic regression, it ignores 0, and uses 1 as the reference, even though I specified ref=first. Here is my code, and I've attached screenshots of my results. Any help is appreciated! Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.adeno1;&lt;BR /&gt;set work.adenovar;&lt;BR /&gt;if jointyears = 0 or hash = 2 then jointyears_cat = "0";&lt;BR /&gt;if 0 LT jointyears LE 2 then jointyears_cat = "1";&lt;BR /&gt;if 2 LT jointyears LE 5 then jointyears_cat = "2";&lt;BR /&gt;else if jointyears GT 5 then jointyears_cat = "3";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.adenovar;&lt;BR /&gt;set work.adeno1;&lt;BR /&gt;if 20 LE refage LE 34 then refagecat = "0";&lt;BR /&gt;if 35 LE refage LE 39 then refagecat = "1";&lt;BR /&gt;if 40 LE refage LE 44 then refagecat = "2";&lt;BR /&gt;if 45 LE refage LE 49 then refagecat = "3";&lt;BR /&gt;if 50 LE refage LE 54 then refagecat = "4";&lt;BR /&gt;else if 55 LE refage LE 59 then refagecat = "5";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if 36 LE hashlage1 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage1 LE 35 then before35 = "1";&lt;BR /&gt;if 36 LE hashlage2 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage2 LE 35 then before35 = "1";&lt;BR /&gt;if 36 LE hashlage3 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage3 LE 35 then before35 = "1";&lt;BR /&gt;if 36 LE hashlage4 LE 60 then before35 = "0";&lt;BR /&gt;else if 3 LE hashlage4 LE 35 then before35 = "1";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = work.adenovar;&lt;BR /&gt;where before35 = "1";&lt;BR /&gt;tables jointyears_cat*casehyst_path / norow nopercent;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title "hysterectomy controls age";&lt;BR /&gt;proc logistic data = adenovar descending;&lt;BR /&gt;where before35 = "1";&lt;BR /&gt;class jointyears_cat refagecat / param = ref ref = first;&lt;BR /&gt;model casehyst_path = jointyears_cat refagecat;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 18:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Not-recognizing-first-level-in-categorical-variable-during/m-p/708616#M9600</guid>
      <dc:creator>gejoachim99</dc:creator>
      <dc:date>2020-12-29T18:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Not recognizing first level in categorical variable during logistic regression</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Not-recognizing-first-level-in-categorical-variable-during/m-p/708626#M9601</link>
      <description>&lt;P&gt;Run a Proc freq on your categorical variable of interest with the same "where before35="1" ".&lt;/P&gt;
&lt;P&gt;If you don't have any 0 where before35='1' then that is the issue: no qualifying data.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 19:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Not-recognizing-first-level-in-categorical-variable-during/m-p/708626#M9601</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-29T19:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Not recognizing first level in categorical variable during logistic regression</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Not-recognizing-first-level-in-categorical-variable-during/m-p/708633#M9602</link>
      <description>This seems to be the case. I see my mistake now! Thank you very much.</description>
      <pubDate>Tue, 29 Dec 2020 19:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Not-recognizing-first-level-in-categorical-variable-during/m-p/708633#M9602</guid>
      <dc:creator>gejoachim99</dc:creator>
      <dc:date>2020-12-29T19:44:07Z</dc:date>
    </item>
  </channel>
</rss>

