<?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: Invalid numeric data error when trying to make a new variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786060#M250921</link>
    <description>Ahhh of course it was something that simple! Thank you so much. I changed the line to if vax_status=" " then vstat=.; Thanks again! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Tue, 14 Dec 2021 21:28:33 GMT</pubDate>
    <dc:creator>joachimg</dc:creator>
    <dc:date>2021-12-14T21:28:33Z</dc:date>
    <item>
      <title>Invalid numeric data error when trying to make a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786054#M250916</link>
      <description>&lt;P&gt;I'm trying to make a binary variable (0, 1) from a variable that has 3 levels, and is character. When I try this code -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data work.cn202103;
set nsf10.cn202103;
if vax_status=. then vstat=.;
if vax_status="No plan to vax" then vstat=1;
if vax_status="Plan to vax" or vax_status="Already vaxxed" then vstat=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or this code -&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data work.cn202103;
set nsf10.cn202103;
if vax_status=. then vstat=.;
else if vax_status="No plan to vax" then vstat=1;
else vstat=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get a TON of error messages like this one -&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;NOTE: Invalid numeric data, vax_status='Already vaxxed' , at line 209 column 4.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can't figure out what I'm doing wrong. Let me know if you need more info, and any help is much appreciated. Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 21:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786054#M250916</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2021-12-14T21:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error when trying to make a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786058#M250919</link>
      <description>&lt;P&gt;The first time vax_status appears, you are testing to see if it is equal to a dot, and that means vax_status is numeric. The next times you test vax_status, you test to see if it is equal to a character string. Vax_status can't be both numeric and character. It must be one or the other. This can be deduced via looking at PROC CONTENTS, and/or looking at the actual data values for Vax_status.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 21:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786058#M250919</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-14T21:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error when trying to make a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786060#M250921</link>
      <description>Ahhh of course it was something that simple! Thank you so much. I changed the line to if vax_status=" " then vstat=.; Thanks again! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 14 Dec 2021 21:28:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786060#M250921</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2021-12-14T21:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error when trying to make a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786061#M250922</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/393705"&gt;@joachimg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tip: from now on, use the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p06ybg84o0asa4n17l9ieauk58hb.htm" target="_self"&gt;MISSING function&lt;/A&gt;, which works properly on both character and numeric values. You should be able to use it without having to first figure out if the variable is character or numeric.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 21:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error-when-trying-to-make-a-new-variable/m-p/786061#M250922</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-14T21:33:06Z</dc:date>
    </item>
  </channel>
</rss>

