<?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: Y/N(char) variable to 0/1(num) with an option in Regression in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763483#M241811</link>
    <description>&lt;P&gt;Do you really need to create dummy variables?&amp;nbsp; Can't you just use a CLASS statement in your analysis step?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you are thinking of the GLMMOD procedure?&amp;nbsp; That should be able to generate dummy variables from your CLASS variables.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Aug 2021 12:06:59 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-08-24T12:06:59Z</dc:date>
    <item>
      <title>Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763396#M241763</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm doing a logistic regression. However, I need to convert about 20&amp;nbsp;&lt;STRONG&gt;independent&lt;/STRONG&gt; characteristic variables to numeric ones in order to check assumptions. I have seen &lt;STRONG&gt;something like an option(probably in a proc step)&lt;/STRONG&gt; to change &lt;STRONG&gt;yes/no&lt;/STRONG&gt; to &lt;STRONG&gt;0/1&lt;/STRONG&gt; in just one step (Not if then, not proc format, not array), but I totally forgot where it came from. I tried my best to search similar stuff( "categorical variable to 1 2 3 in one step",etc), but I haven't found anything like an option that can do the job. I'm sorry that I can't provide more information, any hints would be APPRECIATED!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763396#M241763</guid>
      <dc:creator>Cecillia_Mao</dc:creator>
      <dc:date>2021-08-24T14:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763404#M241770</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NUM=(CHAR='yes');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Aug 2021 02:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763404#M241770</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-24T02:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763476#M241805</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275960"&gt;@Cecillia_Mao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm doing a logistic regression. However, I need to convert characteristic variables to numeric ones in order to check assumptions.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What assumptions? There are not usually any assumptions on character variables, and so no checking is required. So, no conversion to numeric is required either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Logistic regression will run just fine with a character variable as the response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Logistic regression will run just fine with character x-variables if you indicate the variables are character in the CLASS statement.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Again, no conversion from character to numeric is needed for logistic regression. Do the easy thing in this case, use your data as is.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 11:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763476#M241805</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-24T11:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763483#M241811</link>
      <description>&lt;P&gt;Do you really need to create dummy variables?&amp;nbsp; Can't you just use a CLASS statement in your analysis step?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you are thinking of the GLMMOD procedure?&amp;nbsp; That should be able to generate dummy variables from your CLASS variables.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 12:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763483#M241811</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-24T12:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763515#M241822</link>
      <description>&lt;P&gt;Hi Paige,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply! I'm checking the&amp;nbsp; MULTICOLLINEARITY assumption, and I'm using the "Correlation matrix"&amp;nbsp; criteria, which means I need to use “proc corr ” that needs numerical variables.&amp;nbsp; BTW, this is the material I'm referring to&lt;BR /&gt;&lt;A href="https://www.lexjansen.com/wuss/2018/130_Final_Paper_PDF.pdf" target="_blank"&gt;https://www.lexjansen.com/wuss/2018/130_Final_Paper_PDF.pdf&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763515#M241822</guid>
      <dc:creator>Cecillia_Mao</dc:creator>
      <dc:date>2021-08-24T14:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763537#M241824</link>
      <description>&lt;P&gt;Perhaps something needs to be clarified in your original post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are these character variables that you need to convert to numeric x-variables or y-variables? How many are there?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763537#M241824</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-24T14:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763539#M241825</link>
      <description>&lt;P&gt;Thanks so much, Chris! It's not exactly &lt;SPAN style="font-family: inherit;"&gt;what I'm looking for, but it's much better than if-then and proc format in some cases!&amp;nbsp; Thanks for sharing!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:21:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763539#M241825</guid>
      <dc:creator>Cecillia_Mao</dc:creator>
      <dc:date>2021-08-24T14:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763544#M241826</link>
      <description>Thanks for pointing that out, it had been a little bit confusing. I revised the original post a little bit. They are about 20 independent character variables that need to be converted to numeric ones.</description>
      <pubDate>Tue, 24 Aug 2021 14:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763544#M241826</guid>
      <dc:creator>Cecillia_Mao</dc:creator>
      <dc:date>2021-08-24T14:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763545#M241827</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;Thanks for the reply! I made the case a little bit confused in the original post. If only considering running the model itself, the class statement would be enough. However, I just want to change character variables to 0,1,2,3... for assumption check, which sometimes requires the data in numeric format. Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763545#M241827</guid>
      <dc:creator>Cecillia_Mao</dc:creator>
      <dc:date>2021-08-24T14:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Y/N(char) variable to 0/1(num) with an option in Regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763548#M241830</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275960"&gt;@Cecillia_Mao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks for pointing that out, it had been a little bit confusing. I revised the original post a little bit. They are about 20 independent character variables that need to be converted to numeric ones.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you really ought to create dummy variables, and if there are more than two levels of a specific variable, this is more complicated than the suggestion from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;. Here is a long thread on many &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-dummy-variables-Categorical-Variables/ta-p/308484" target="_self"&gt;different ways&lt;/A&gt; to create dummy variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, checking multicollinearity is not checking "assumptions", so that threw me off. An assumption in modeling would be something like does a variable have the proper distribution. Multicollinearity is certain a concern, but it isn't what I think would be called an "assumption".&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:37:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Y-N-char-variable-to-0-1-num-with-an-option-in-Regression/m-p/763548#M241830</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-24T14:37:08Z</dc:date>
    </item>
  </channel>
</rss>

