<?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: &amp;quot;Invalid Numeric Data&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quot-Invalid-Numeric-Data-quot/m-p/805638#M317369</link>
    <description>&lt;P&gt;By assigning a numeric missing value (the dot), you implicitly define race as numeric, so you cannot later on store a character value in it. Define it properly as character in a LENGTH statement, and your first IF becomes unnecessary (a value of only blanks &lt;EM&gt;is&lt;/EM&gt; a missing character value).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, avoid the hassle of creating and uploading a Word file; instead simply copy/paste the&amp;nbsp;&lt;EM&gt;complete&lt;/EM&gt; log text (code and messages) into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 02 Apr 2022 19:15:52 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-04-02T19:15:52Z</dc:date>
    <item>
      <title>"Invalid Numeric Data"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Invalid-Numeric-Data-quot/m-p/805636#M317367</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to recode my "race" variable into 5 categories. When I go to create the 5th category labeled as "other" it spits out a bunch of errors. If someone could help me that would be great!&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 18:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Invalid-Numeric-Data-quot/m-p/805636#M317367</guid>
      <dc:creator>Sassybanana</dc:creator>
      <dc:date>2022-04-02T18:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: "Invalid Numeric Data"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Invalid-Numeric-Data-quot/m-p/805638#M317369</link>
      <description>&lt;P&gt;By assigning a numeric missing value (the dot), you implicitly define race as numeric, so you cannot later on store a character value in it. Define it properly as character in a LENGTH statement, and your first IF becomes unnecessary (a value of only blanks &lt;EM&gt;is&lt;/EM&gt; a missing character value).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, avoid the hassle of creating and uploading a Word file; instead simply copy/paste the&amp;nbsp;&lt;EM&gt;complete&lt;/EM&gt; log text (code and messages) into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 19:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Invalid-Numeric-Data-quot/m-p/805638#M317369</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-02T19:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: "Invalid Numeric Data"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Invalid-Numeric-Data-quot/m-p/805643#M317373</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/403443"&gt;@Sassybanana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just delete the first line with where you set race to missing as that's already going to happen in your else case when Mob_s_Race is missing.&lt;/P&gt;
&lt;P&gt;Because race also character IF you want to keep the line then it should be:&lt;/P&gt;
&lt;PRE&gt;if MOB_s_Race = ' ' then race=' ';&lt;/PRE&gt;
&lt;P&gt;And another thing you need to change:&lt;/P&gt;
&lt;P&gt;MOB_s_Race can only ever have one value at a time. For this reason you need to use OR instead of AND - else the expression will never become true. You also would need to repeat the variable name for such an expression or use the IN operator instead.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1648935728023.png" style="width: 880px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70055i5F61D56D271CCFD3/image-dimensions/880x66?v=v2" width="880" height="66" role="button" title="Patrick_0-1648935728023.png" alt="Patrick_0-1648935728023.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;if Mob_s_Race='abc' OR Mob_s_Race='abc' ='xyz' OR.... then...

if Mob_s_Race in ('abc', 'xyz', ....) then...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's often also useful to UPCASE() the variable because such character comparisons are case sensitive.&lt;/P&gt;
&lt;PRE&gt;if upcase(Mob_s_Race) in ('ABC', 'XYZ', ....) then...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 21:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Invalid-Numeric-Data-quot/m-p/805643#M317373</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-04-02T21:53:20Z</dc:date>
    </item>
  </channel>
</rss>

