<?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: Note: Invalid numeric data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427451#M105419</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91804"&gt;@Malathi13&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, I got the answer!!. One of the observation was numeric in that Variable, I deleted that and I got the answer.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Glad you fixed your problem, but that statement makes no sense. A variable has the same type for every observation in a dataset. SAS datasets are not spreadsheets.&amp;nbsp; And even if your error was caused by code that was attempting to convert a character variable into a number such as :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;disposition = disposition + 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then ithe one observation that held a string that looked like a number that would be the one that did NOT generate an error or warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 13 Jan 2018 16:22:39 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-01-13T16:22:39Z</dc:date>
    <item>
      <title>Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427275#M105352</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm getting a&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, Disposition='TREATED TRANSPORTED', at line&lt;/P&gt;&lt;P&gt;353 column 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;set test;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Canceled, No Patient Contact'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Canceled'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Unresponsive– Pronounced'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; or Disposition eq '&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;dead' &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Dead'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Treated Transported' &lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;or Disposition= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Treated and transported'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'TREATED TRANSPORTED'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Treated and Released (per protocol)'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Disposition=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Treated and Released'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, Disposition='TREATED TRANSPORTED' , at line&lt;/P&gt;&lt;P&gt;353 column 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked at other previous responses to Invalid numeric data errors, but I didn't get the answer for this. I tried all the suggestions but they didn't work for my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427275#M105352</guid>
      <dc:creator>Malathi13</dc:creator>
      <dc:date>2018-01-12T17:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427278#M105353</link>
      <description>&lt;P&gt;I would guess looking at the data in line 353 of test would be a place to start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427278#M105353</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-01-12T17:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427287#M105356</link>
      <description>&lt;P&gt;Thank you, I got the answer!!. One of the observation was numeric in that Variable, I deleted that and I got the answer.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:29:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427287#M105356</guid>
      <dc:creator>Malathi13</dc:creator>
      <dc:date>2018-01-12T17:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427290#M105359</link>
      <description>&lt;P&gt;I guess DISPOSITION is defined as numeric in your input with a format displaying text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Run proc contents for your input dataset. Is this field realy defined as numeric ? and what format is attached to it ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=test; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Assuming there is a format then run:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format lib=&amp;lt;format catalog library&amp;gt; list;
   select &amp;lt;format name&amp;gt;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;then replace your code to check for the numeric code and assign numeric code - instead dealing with textual value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Alternatively you can use PUT/INPUT functions with the format/informat to create a new char type variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427290#M105359</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-01-12T17:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427292#M105360</link>
      <description>&lt;P&gt;I would run proc contents on the dataset. Sounds like disposition is actually a numeric field and what you really want to do is change the format that is being applied to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427292#M105360</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-12T17:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427295#M105361</link>
      <description>&lt;P&gt;Try copy and pasting the entire code and messages from the log for that data step into a code box opened with the forum {I} menu icon.&lt;/P&gt;
&lt;P&gt;We cant tell which line or column of our code (though I can guess I hate doing that).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do this sort of thing frequently then you might want to learn the select statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;select (Disposition); 
   When ('Canceled, No Patient Contact')  Disposition= 'Canceled';
   When ('Unresponsive– Pronounced', 'dead')  Disposition='Dead';
   When ('Treated Transported' ,'Treated and transported')  Disposition='TREATED TRANSPORTED';
   When ('Treated and Released (per protocol)'  Disposition='Treated and Released';
   otherwise; /* do nothing*/
end;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427295#M105361</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-12T17:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427326#M105369</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; That is both new to me and very slick.</description>
      <pubDate>Fri, 12 Jan 2018 19:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427326#M105369</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-01-12T19:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427386#M105382</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6401"&gt;@HB&lt;/a&gt; wrote:&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; That is both new to me and very slick.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6401"&gt;@HB&lt;/a&gt;&amp;nbsp;Select is very good way to deal with things that many folks do multiple if/then/else. Note that the When result can also be a DO/End block of code.&lt;/P&gt;
&lt;P&gt;The main obstacle is dealing with ranges of numeric as order can become very important such as with:&lt;/P&gt;
&lt;PRE&gt; grade = select
   when (score &amp;gt;= 90) 'A'
   when (score &amp;gt;= 80) 'B'
   when (score &amp;gt;= 70) 'C'
   when (score &amp;gt;= 60) 'D'
   when (score &amp;gt;= 0 ) 'F'
 end;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that changing the order of the whens above could result in a significantly different grade.&lt;/P&gt;
&lt;P&gt;Which points a modification of my earlier post which is left to the interested reader.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 22:31:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427386#M105382</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-12T22:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427451#M105419</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91804"&gt;@Malathi13&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, I got the answer!!. One of the observation was numeric in that Variable, I deleted that and I got the answer.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Glad you fixed your problem, but that statement makes no sense. A variable has the same type for every observation in a dataset. SAS datasets are not spreadsheets.&amp;nbsp; And even if your error was caused by code that was attempting to convert a character variable into a number such as :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;disposition = disposition + 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then ithe one observation that held a string that looked like a number that would be the one that did NOT generate an error or warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2018 16:22:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427451#M105419</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-13T16:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427457#M105423</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Thank you for your suggestions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tom,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;to give you an expiation of my data, variable disposition is character but one of the observation in that variable as 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.x. &amp;nbsp; Dispostion&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Treated&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Treated and Transported&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dead&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Transferred&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pronounced Dead&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that's what I have in the dataset for Variable Disposition. When I used if-then to delete, I used&lt;/P&gt;&lt;P&gt;if disposition='Treated" then disposition='Treated and Transported';&lt;/P&gt;&lt;P&gt;if deposition=1 then delete;&lt;/P&gt;&lt;P&gt;if disposition='Pronounced Dead' then disposition='Dead';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that's when I was getting that NOTE: Invalid numeric error. I fixed it by adding quotations to 1 (see below) and my error got fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if disposition='1' then delete;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2018 18:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427457#M105423</guid>
      <dc:creator>Malathi13</dc:creator>
      <dc:date>2018-01-13T18:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427461#M105425</link>
      <description>&lt;P&gt;Now the error you received makes perfect sense and, yes, putting quotes around the 1 will resolve that particular error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, you code has other mistakes. e.g.:&lt;/P&gt;
&lt;PRE&gt;if disposition='Treated" then disposition='Treated and Transported';
&lt;/PRE&gt;
&lt;P&gt;You can't mix single and double quotes. It would have to be either 'Treated' or "Treated"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if deposition=1 then delete;
&lt;/PRE&gt;
&lt;P&gt;Are you trying to evaluate desposition or disposition?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2018 19:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427461#M105425</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-13T19:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Note: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427467#M105429</link>
      <description>I made error in typing but the code I have is correct. Sorry for spelling mistakes. It’s disposition and in my actual code I have single quotes. I did see that I mixed the codes here while writing. It’s ‘Treated’ not ‘Treated”. Good catch.&lt;BR /&gt;</description>
      <pubDate>Sat, 13 Jan 2018 20:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Note-Invalid-numeric-data/m-p/427467#M105429</guid>
      <dc:creator>Malathi13</dc:creator>
      <dc:date>2018-01-13T20:34:35Z</dc:date>
    </item>
  </channel>
</rss>

