<?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: How do you create a dichotomous variable from a variable with 4 categories? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829120#M35495</link>
    <description>&lt;P&gt;Depends on what you're doing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In some cases you may exclude them entirely. In other cases, you would include them as a third group combined, such as other.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2022 20:37:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-08-17T20:37:39Z</dc:date>
    <item>
      <title>How do you create a dichotomous variable from a variable with 4 categories?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829114#M35494</link>
      <description>&lt;P&gt;The original variable for race has the following categories for participants:&lt;/P&gt;&lt;P&gt;1 = White&lt;/P&gt;&lt;P&gt;2 = African American/Black&lt;/P&gt;&lt;P&gt;3 = Asian&lt;/P&gt;&lt;P&gt;4 = Other&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For my analysis, I am only interested in White and African American/Black participants. I want to create a new variable: race_dich_pt using the if then else statement. What do I do with categories 3 and 4?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if race = 1 then race_dich_pt = 1; /*White*/&lt;BR /&gt;else if race = 2 then race_dich_pt = 0; /*African American/Black*/&lt;BR /&gt;else if race = 3 then race_dich_pt =&lt;/P&gt;&lt;P&gt;else if race = 4 then race_dich_pt =&amp;nbsp;&lt;/P&gt;&lt;P&gt;else if race = . then race_dich_pt = .;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 20:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829114#M35494</guid>
      <dc:creator>gtucke1</dc:creator>
      <dc:date>2022-08-17T20:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a dichotomous variable from a variable with 4 categories?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829120#M35495</link>
      <description>&lt;P&gt;Depends on what you're doing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In some cases you may exclude them entirely. In other cases, you would include them as a third group combined, such as other.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 20:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829120#M35495</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-17T20:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a dichotomous variable from a variable with 4 categories?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829126#M35496</link>
      <description>&lt;PRE&gt;if race = 1 then race_dich_pt = 1; /*White*/
else if race = 2 then race_dich_pt = 0; /*African American/Black*/
else  race_dich_pt = . ;
&lt;/PRE&gt;
&lt;P&gt;But you will want to make sure that any analysis or write up explains that using this variable should exclude XX% of records where XX is the percent of everything non-White and non-Black.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 21:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829126#M35496</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-17T21:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a dichotomous variable from a variable with 4 categories?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829128#M35497</link>
      <description>&lt;P&gt;Thank you very much for your help with the code and suggestion for how to describe the other %.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 22:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829128#M35497</guid>
      <dc:creator>gtucke1</dc:creator>
      <dc:date>2022-08-17T22:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a dichotomous variable from a variable with 4 categories?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829165#M35499</link>
      <description>&lt;P&gt;The other thing you can do is use a WHERE clause to exclude the observations you don't want. Then there is no need to recode the data. For example,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=Have;
   where Race=1 or Race=2;
   tables Race;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 09:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-you-create-a-dichotomous-variable-from-a-variable-with-4/m-p/829165#M35499</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-08-18T09:56:38Z</dc:date>
    </item>
  </channel>
</rss>

