<?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: SAS not recognizing variable levels - ordinal regression in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756302#M36830</link>
    <description>&lt;P&gt;All variables in PROC MEANS must be numeric, so the errors from PROC MEANS are because your variables are character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the NotUsed data set, you need to see if every observation with Cancer="No" contains a missing value for some variable in your model - any of the predictors or the response. You will find that that is the case. Note that the observations will probably have missings in different variables, but as long as there is a missing in any of the model variables, then the observation will be ignored.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jul 2021 19:21:45 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2021-07-23T19:21:45Z</dc:date>
    <item>
      <title>SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756095#M36822</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I attempting an ordinal regression analysis and for some reason, SAS does not recognize one of the levels of my variable. I have a variable called 'cancer', with two levels, 'yes' or 'no'. When I set the reference value as 'no' I receive an error saying invalid reference. So instead, I try 'yes' instead, the procedure seems to work however, when I am looking at the output I have no estimates related to my cancer variable. This is my code:&lt;BR /&gt;&lt;BR /&gt;proc logistic data=WORK.THESIS desc;&lt;BR /&gt;class age(ref='18 to 24 years') sex(ref='Male') education(ref='Some formal education') income(ref='Less than $30,000')&lt;BR /&gt;relationship(ref='Immediate family member') Healthcare(ref='No') Cancer(ref='No') / param=reference;&lt;BR /&gt;model category1 = age sex education income healthcare relationship cancer;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Please help! Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 23:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756095#M36822</guid>
      <dc:creator>Roxxanne</dc:creator>
      <dc:date>2021-07-22T23:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756098#M36823</link>
      <description>&lt;P&gt;Is there a format applied on the variable? SAS expects the formatted value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post the actual log as well, it helps to indicate where the error may be, if you can't do that, what happens if you run a PROC FREQ on the CANCER variable?.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=thesis;
table cancer*category1 / missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/388520"&gt;@Roxxanne&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I attempting an ordinal regression analysis and for some reason, SAS does not recognize one of the levels of my variable. I have a variable called 'cancer', with two levels, 'yes' or 'no'. When I set the reference value as 'no' I receive an error saying invalid reference. So instead, I try 'yes' instead, the procedure seems to work however, when I am looking at the output I have no estimates related to my cancer variable. This is my code:&lt;BR /&gt;&lt;BR /&gt;proc logistic data=WORK.THESIS desc;&lt;BR /&gt;class age(ref='18 to 24 years') sex(ref='Male') education(ref='Some formal education') income(ref='Less than $30,000')&lt;BR /&gt;relationship(ref='Immediate family member') Healthcare(ref='No') Cancer(ref='No') / param=reference;&lt;BR /&gt;model category1 = age sex education income healthcare relationship cancer;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Please help! Thank you.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 23:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756098#M36823</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-22T23:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756102#M36824</link>
      <description>&lt;P&gt;Hi Reeza,&lt;BR /&gt;&lt;BR /&gt;Thank you for your reply. Here is the log when I put the code mentioned previously:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Roxxanne_0-1626999593626.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61613iFC2D4EA4AEF1708C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Roxxanne_0-1626999593626.png" alt="Roxxanne_0-1626999593626.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run proc freq on the cancer variable everything looks ok to me (I am aware there are some missing values), here is the output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Roxxanne_1-1626999687087.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61614i53085C6343182B43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Roxxanne_1-1626999687087.png" alt="Roxxanne_1-1626999687087.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I am not sure if there is a format applied.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 00:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756102#M36824</guid>
      <dc:creator>Roxxanne</dc:creator>
      <dc:date>2021-07-23T00:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756134#M36825</link>
      <description>&lt;P&gt;The actual value for your Cancer variable could be " No", with one or more leading spaces. Proc Freq and almost all of the tabular output from SAS procs will left justify removing such spaces. As a reference level you need the actual value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc contents run against the data set will show all of the formats and variable types. Or click on the column header in SAS table viewer to get details about the variable. &lt;/P&gt;
&lt;P&gt;It is very common to have numeric 1/0 coded variables to have a format that displays Yes/No . If you see that the variable is numeric you might try using 0 as the reference.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 06:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756134#M36825</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-07-23T06:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756192#M36826</link>
      <description>&lt;P&gt;This sort of problem in any modeling procedure is usually due to missing values in the other variables involved in the model. An observation is ignored if any variable involved in the model (response, predictor, weight, freq, offset, etc.) is missing. The issue is probably the result of missing values in other variables excluding all observations in one level of your cancer variable. Note that observations may be excluded as a result of having missing values in different variables, so all observations can be excluded even if the cancer variable has nonmissing values in both levels.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 13:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756192#M36826</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-07-23T13:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756193#M36827</link>
      <description>&lt;P&gt;You can test whether Dave's conjecture is correct by looking at the pattern of missing values. See the first PROC MI example in the article, &lt;A href="https://blogs.sas.com/content/iml/2017/11/29/visualize-patterns-missing-values.html" target="_self"&gt;"Visualize patterns of missing values."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 13:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756193#M36827</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-23T13:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756241#M36828</link>
      <description>&lt;P&gt;You might want to examine the observations that were ignored in the model fit to understand the cause. An easy way to do that is to add an OUTPUT statement in your PROC LOGISTIC step to save the predicted values. Predicted values are missing if any variable, other than the response, was missing. You can then easily create a data set of the observations that were ignored and examine them. For example, these statements create a data set, NotUsed, that contains all of the observations that were ignored.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=WORK.THESIS desc;
class age(ref='18 to 24 years') sex(ref='Male') education(ref='Some formal education') income(ref='Less than $30,000')
relationship(ref='Immediate family member') Healthcare(ref='No') Cancer(ref='No') / param=reference;
model category1 = age sex education income healthcare relationship cancer;
output out=out p=p;
run;
data NotUsed; set out; if cmiss(of p category1); run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Jul 2021 15:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756241#M36828</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-07-23T15:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756297#M36829</link>
      <description>&lt;P&gt;Thank you for your reply.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I ran the code you sent me but I am not too sure what I am suppose to be looking for.. I am aware my datasets has a decent amount of missing data as all of our predictor variables were optional questions, so every variable has some missing values. I am not sure if this is useful information however, the variable 'relationship' only has values for individuals who answered yes to the 'cancer' variable. I also tried removing relationship from the model however, I still receive the same error as previously mentioned (invalid reference for cancer).&lt;BR /&gt;&lt;BR /&gt;I also tried what Rick mentioned by running proc MI however, I received the same error for all my variables:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Roxxanne_0-1627067116898.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61643i8BF50D57E6A939DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Roxxanne_0-1627067116898.png" alt="Roxxanne_0-1627067116898.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also tried this code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Roxxanne_1-1627067251515.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61644iB0921583BF36748B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Roxxanne_1-1627067251515.png" alt="Roxxanne_1-1627067251515.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am not sure if the issue is because all my predictor variables are categorical?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 19:08:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756297#M36829</guid>
      <dc:creator>Roxxanne</dc:creator>
      <dc:date>2021-07-23T19:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756302#M36830</link>
      <description>&lt;P&gt;All variables in PROC MEANS must be numeric, so the errors from PROC MEANS are because your variables are character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the NotUsed data set, you need to see if every observation with Cancer="No" contains a missing value for some variable in your model - any of the predictors or the response. You will find that that is the case. Note that the observations will probably have missings in different variables, but as long as there is a missing in any of the model variables, then the observation will be ignored.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 19:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756302#M36830</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-07-23T19:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS not recognizing variable levels - ordinal regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756311#M36831</link>
      <description>Since your variables are categorical, PROC FREQ is more appropriate than MEANS. &lt;BR /&gt;&lt;BR /&gt;When running a model, SAS excludes any row that has any missing values for any variables referenced in the PROC.  Because you only have a few Cancer cases is it possible that those are being excluded entirely because of other missing values in your data?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Jul 2021 20:25:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-not-recognizing-variable-levels-ordinal-regression/m-p/756311#M36831</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-23T20:25:34Z</dc:date>
    </item>
  </channel>
</rss>

