<?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 I recode a race variable keeping the same variable name? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301682#M63891</link>
    <description>&lt;P&gt;Sorry, I misread the part in the original post about the error message. &amp;nbsp;But the next steps wouldn't change ... run the test PROC PRINTs, and it might also help to post the log from the original program.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2016 03:17:17 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-09-30T03:17:17Z</dc:date>
    <item>
      <title>How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301615#M63865</link>
      <description>&lt;P&gt;I currently have a race variable categorized as Asian, Black or Africian-American, Native Hawaiian or Pacific Islander, Other or White. &amp;nbsp;I would like to change the Asian and Native Hawaiian or Pacific Islander to Other using the same race variable name. &amp;nbsp;I did not create the dataset. &amp;nbsp;I am doing secondary data analysis. &amp;nbsp;I am using SAS 9.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the following code, but it did not work and did not give me an error message. &amp;nbsp;Do I have to create a new variable for race or can I use the same variable name?&lt;/P&gt;&lt;P&gt;if strip(race)="Native Hawaiian or Pacific Islander" OR strip(race)="Asian" then race="Other";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help that could be provided would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Paula&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 19:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301615#M63865</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2016-09-29T19:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301619#M63866</link>
      <description>&lt;P&gt;The concept is correct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do have to make sure it's exactly matching the string, case et al.&lt;/P&gt;
&lt;P&gt;Is it Native Hawaiian or Pacific Islander in one field or are those separate? I also find IN easier to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if strip(race) in ("Native Hawaiian or Pacific Islander", "Asian")  then race="Other";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Sep 2016 19:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301619#M63866</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-29T19:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301620#M63867</link>
      <description>&lt;P&gt;Well, you didn't tell us what the error message actually is.&amp;nbsp; So here's my guess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess that your RACE variable is actually numeric.&amp;nbsp; The strings that you are looking at like "Asian" are actually formatted values.&amp;nbsp; So you can't apply STRIP to a numeric variable.&amp;nbsp; Here's how you would confirm this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=have (obs=20);&lt;/P&gt;
&lt;P&gt;var race;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=have (obs=20);&lt;/P&gt;
&lt;P&gt;var race;&lt;/P&gt;
&lt;P&gt;format race;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The FORMAT statement (with no format named) will remove any existing format from the variable, for the purposes of running the second PROC PRINT.&amp;nbsp; Then you can see whether the actual values are different than the displayed values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 19:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301620#M63867</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-29T19:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301631#M63871</link>
      <description>&lt;P&gt;Personally I would recommend either developing a custom format to change displayed values without changing the variable OR create an entire new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would bet a small pile of quarters that some time in the future you get asked to report on one or both of Asian or NHOPI. Which will be much easier if the values still exist.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 20:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301631#M63871</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-29T20:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301676#M63886</link>
      <description>&lt;P&gt;Thank you for your message. I &lt;U&gt;did not&lt;/U&gt; receive an error message which is the reason I could not figure out why it did not work.&lt;/P&gt;&lt;P&gt;I will try your suggestion to see if the actual variable is numeric or categorical.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 02:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301676#M63886</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2016-09-30T02:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301677#M63887</link>
      <description>I just checked and it is all in one field.</description>
      <pubDate>Fri, 30 Sep 2016 02:11:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301677#M63887</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2016-09-30T02:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301678#M63888</link>
      <description>ok. Thanks for your suggestion and response.</description>
      <pubDate>Fri, 30 Sep 2016 02:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301678#M63888</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2016-09-30T02:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I recode a race variable keeping the same variable name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301682#M63891</link>
      <description>&lt;P&gt;Sorry, I misread the part in the original post about the error message. &amp;nbsp;But the next steps wouldn't change ... run the test PROC PRINTs, and it might also help to post the log from the original program.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 03:17:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-recode-a-race-variable-keeping-the-same-variable-name/m-p/301682#M63891</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-30T03:17:17Z</dc:date>
    </item>
  </channel>
</rss>

