<?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 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79162#M22813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;data psneo_m9192; &lt;/P&gt;&lt;P&gt;set ps_m9192; &lt;/P&gt;&lt;P&gt;if 140&amp;lt;=input(substr(icd9,1,3),4.)le 239;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jun 2012 22:32:38 GMT</pubDate>
    <dc:creator>Linlin</dc:creator>
    <dc:date>2012-06-08T22:32:38Z</dc:date>
    <item>
      <title>Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79161#M22812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would really appreciate any help with the following issue I'm having:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working with administrative health data and am trying to identify all cancers (by their diagnosis codes).&amp;nbsp; I want to use a substring command to identify numbered diagnostic codes within a certain range within a variable in character format.&amp;nbsp; I can't just convert this variable to a numeric variable because there are various other data points (that i'm not interested in) that are nominal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifically, I want to identify all diagnosis codes ranging from 140 to 239, and ignore all other data.&amp;nbsp; When I run the data step, I get an error message that reads:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;NOTE: Invalid numeric data, '01L' , at line 1276 column 36. &lt;/STRONG&gt;(for several data points)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the relevant code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: #003366;"&gt;&lt;SPAN style="color: #000080;"&gt;data&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;psneo_m9192; &lt;SPAN style="color: #0000ff;"&gt;set&lt;/SPAN&gt; ps_m9192;&lt;SPAN style="color: #0000ff;"&gt; if&lt;/SPAN&gt; substr(icd9,&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;) ge 140 and substr(icd9,&lt;STRONG style="color: #008080;"&gt;1&lt;/STRONG&gt;,&lt;STRONG style="color: #008080;"&gt;3&lt;/STRONG&gt;) le 239; &lt;STRONG style="color: #000080;"&gt;run&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Despite this, SAS still outputs a dataset with what appears to be the correct range of data.&amp;nbsp; However, I don't know if it is complete/accurate or what the error message means.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;1) Is the problem that I am trying to identify a numeric range of data in a character variable? &lt;/P&gt;&lt;P&gt;2) How can I know if my output dataset is complete?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 22:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79161#M22812</guid>
      <dc:creator>EpiLinds</dc:creator>
      <dc:date>2012-06-08T22:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79162#M22813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;data psneo_m9192; &lt;/P&gt;&lt;P&gt;set ps_m9192; &lt;/P&gt;&lt;P&gt;if 140&amp;lt;=input(substr(icd9,1,3),4.)le 239;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 22:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79162#M22813</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-06-08T22:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79163#M22814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Linlin, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the feedback.&amp;nbsp; I tried running this code and got a number of different error messages like this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOTE: Invalid argument to function INPUT at line 1279 column 41.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this issue is related to the mix of data points under this icd9 variable, some of which are non-numeric.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The good news is that when I ran it with your code, my output dataset had the same number of observations as when I ran it using the code above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you think it's likely that I'm missing some relevant data because of these errors or is this something I should just ignore?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 23:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79163#M22814</guid>
      <dc:creator>EpiLinds</dc:creator>
      <dc:date>2012-06-08T23:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79164#M22815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try the code below to avoid error message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input icd9 $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;123df&lt;/P&gt;&lt;P&gt;321gd&lt;/P&gt;&lt;P&gt;230bg&lt;/P&gt;&lt;P&gt;345kg&lt;/P&gt;&lt;P&gt;ddddd&lt;/P&gt;&lt;P&gt;150gh&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if anydigit(icd9);/*exclude the observations without digits */&lt;/P&gt;&lt;P&gt;if 140&amp;lt;=input(substr(icd9,1,3),4.)le 239;&lt;/P&gt;&lt;P&gt;proc print;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 00:15:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79164#M22815</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-06-09T00:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79165#M22816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Frankly, it is just a note, not an error (although _error_ will be flagged), so data step will move on, and it will not affect your results. Unless you want to include (or investigate) those obs, you can take it easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: if you are really annoyed by the note, following code may help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data psneo_m9192; set ps_m9192; &lt;/P&gt;&lt;P&gt;if&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not ANYALPHA(substr(icd9,1,3));&lt;/P&gt;&lt;P&gt;if&amp;nbsp; 140 &amp;lt;= substr(icd9,1,3) &amp;lt;= 239; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 00:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79165#M22816</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-06-09T00:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79166#M22817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... if the diagnosis code is a character variable, why not treat it like a character variable ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;where icd9 ge : '140' and icd9 le : '239';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 02:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79166#M22817</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-06-09T02:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79167#M22818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although I was not able to get rid of the error notes by trying the suggestions above, I got the same number of observations however I ran it so I am just going to ignore the notes and proceed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linds&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 22:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79167#M22818</guid>
      <dc:creator>EpiLinds</dc:creator>
      <dc:date>2012-06-09T22:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79168#M22819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want suppress the information. using a little modifier ?? .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data psneo_m9192; &lt;/P&gt;&lt;P&gt;set ps_m9192; &lt;/P&gt;&lt;P&gt;if 140&amp;lt;=input(substr(icd9,1,3),?? 4.)le 239;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2012 02:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79168#M22819</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-06-11T02:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79169#M22820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You got the same number of observations, FOR THIS BATCH OF DATA.&amp;nbsp; There is no guarantee that you can ignore these messages for the next batch of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of the key issues to decide is whether you would like to select an ICD9 code that begins with 15L.&amp;nbsp; Does it fall into the range you specified?&amp;nbsp; Some methods select it, some methods don't.&amp;nbsp; It's your call if you want to investigate further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2012 13:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79169#M22820</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-06-11T13:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79170#M22821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EpiLinds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Astounding has good advice.&amp;nbsp; ICD data can bite you...&amp;nbsp; "01L" is a code for a laboratory only visit; see&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.health.gov.bc.ca/msp/infoprac/diagcodes/index.pdf" title="http://www.health.gov.bc.ca/msp/infoprac/diagcodes/index.pdf"&gt;http://www.health.gov.bc.ca/msp/infoprac/diagcodes/index.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should use the INPUT function to explicitly convert your text to numbers (saves CPU cycles and is well defined).&amp;nbsp;&amp;nbsp;&amp;nbsp; I would modify Haikou's code to include it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data psneo_m9192; set ps_m9192; &lt;/P&gt;&lt;P&gt;if&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not ANYALPHA(substr(icd9,1,3));&lt;/P&gt;&lt;P&gt;if&amp;nbsp; 140 &amp;lt;= INPUT(substr(icd9,1,3)) &amp;lt;= 239; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2012 20:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Invalid-numeric-data/m-p/79170#M22821</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2012-06-11T20:16:59Z</dc:date>
    </item>
  </channel>
</rss>

