<?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: Converting binomial variables with Yes/No into variables that display 1/0 in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781591#M31816</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/378638"&gt;@u58469353&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to perform logistic regression on a dataset that contains several binomial variables. How do I convert multiple variables with "yes" and "no" as the only inputs to "0" and "1"?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have looked at some other questions on here where users asked similar questions, however, I can't seem to get it to work. When I tried, all of the values for the variable changed to 1, with no values showing 0.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For a Logistic regression, you should not have to convert anything. "yes" and "no" should work fine without creating 0 and 1. So make your life simple, don't create the 0 and 1 variable. (How easy is that?)&lt;/P&gt;</description>
    <pubDate>Sun, 21 Nov 2021 22:58:22 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-11-21T22:58:22Z</dc:date>
    <item>
      <title>Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781571#M31811</link>
      <description>&lt;P&gt;I am trying to perform logistic regression on a dataset that contains several binomial variables. How do I convert multiple variables with "yes" and "no" as the only inputs to "0" and "1"?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have looked at some other questions on here where users asked similar questions, however, I can't seem to get it to work. When I tried, all of the values for the variable changed to 1, with no values showing 0.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 19:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781571#M31811</guid>
      <dc:creator>u58469353</dc:creator>
      <dc:date>2021-11-21T19:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781574#M31812</link>
      <description>&lt;P&gt;Let's assume you mean a binary variable. (A binomial variable is a number that represents the count, or sum, of a series of binary variables. In other words a variable whose values follow a binomial distribution.).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable contains text like YES or No then you cannot convert it into a number in the same variable.&amp;nbsp; You can either convert the strings '1' an '0'.&amp;nbsp; Or make a new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is simple conversion that takes advantage of the fact that SAS will evaluate boolean expressions to 1 when True and 0 when false.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  new_var = old_var= 'yes';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But be careful.&amp;nbsp; Are the values only exact 'yes' or 'no'?&amp;nbsp; Do you ever have missing values?&amp;nbsp; If so this code will convert those to zero (false) instead of missing.&amp;nbsp; Is the case of the string consistent?&amp;nbsp; Do you ever have 'Yes' or 'YES' or 'Y' or 'y' instead of 'yes'?&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 20:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781574#M31812</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-21T20:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781575#M31813</link>
      <description>All of the values in the field are either 'Yes' or 'No'&lt;BR /&gt;</description>
      <pubDate>Sun, 21 Nov 2021 21:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781575#M31813</guid>
      <dc:creator>u58469353</dc:creator>
      <dc:date>2021-11-21T21:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781576#M31814</link>
      <description>&lt;P&gt;All of the values for the variable are wither 'Yes' or 'No'&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 21:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781576#M31814</guid>
      <dc:creator>u58469353</dc:creator>
      <dc:date>2021-11-21T21:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781587#M31815</link>
      <description>&lt;P&gt;This does not work. Causes all values in the new variable to be 0&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 22:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781587#M31815</guid>
      <dc:creator>u58469353</dc:creator>
      <dc:date>2021-11-21T22:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781591#M31816</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/378638"&gt;@u58469353&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to perform logistic regression on a dataset that contains several binomial variables. How do I convert multiple variables with "yes" and "no" as the only inputs to "0" and "1"?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have looked at some other questions on here where users asked similar questions, however, I can't seem to get it to work. When I tried, all of the values for the variable changed to 1, with no values showing 0.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For a Logistic regression, you should not have to convert anything. "yes" and "no" should work fine without creating 0 and 1. So make your life simple, don't create the 0 and 1 variable. (How easy is that?)&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 22:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781591#M31816</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-21T22:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781592#M31817</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/378638"&gt;@u58469353&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;All of the values for the variable are wither 'Yes' or 'No'&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please examine your data and the code you are using very very carefully. 'Yes' is not the same as 'yes'. Can you see the difference?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 11:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781592#M31817</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-22T11:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Converting binomial variables with Yes/No into variables that display 1/0</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781656#M31820</link>
      <description>&lt;P&gt;Please post your code in a code box.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 06:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-binomial-variables-with-Yes-No-into-variables-that/m-p/781656#M31820</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-22T06:17:00Z</dc:date>
    </item>
  </channel>
</rss>

