<?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: error reading numerical value with decimals in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490835#M128553</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to everybody for replying . I am closing this question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will use the column input method to read the data instead of&amp;nbsp; informat method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;jana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 13:31:24 GMT</pubDate>
    <dc:creator>ariyurjana</dc:creator>
    <dc:date>2018-08-29T13:31:24Z</dc:date>
    <item>
      <title>error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490436#M128306</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;I am trying to read the a datafile with the following fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;137&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.35&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Afghanistan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2009-07-08&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code look like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;informat casedt1id&amp;nbsp; :$3. contntid :4.2. country :&amp;amp;$32. casedt1 :yymmdd10.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting error reading the value 3.35 for which I have used&amp;nbsp; :4.2 or just 4.2. the error I am receiving is in the attached png file.&lt;/P&gt;&lt;P&gt;this has no special characters like dollar/comma/percentage a standard number, if I am getting error using w.d what have i not understood, please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;jana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 12:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490436#M128306</guid>
      <dc:creator>ariyurjana</dc:creator>
      <dc:date>2018-08-28T12:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490449#M128310</link>
      <description>&lt;P&gt;Please post the complete data-step used to read the data and the log with the error message. Both as text using the "insert sas code" button above the text-box.&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="grafik.png" style="width: 127px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21688iFF67361C1D1625FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grafik.png" alt="grafik.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 13:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490449#M128310</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-08-28T13:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490454#M128312</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc123 replace ;

informat casedt1id  :$3. contntid 4.2 .  country :&amp;amp;$32. casedt1 yymmdd10. cumrep4 cumrep5 cumrep6 cumrep7 cumrep8 5.
			dthdtid1 :$3.  dthcontntid 4. dthdt1 yymmdd10. cumdth5 cumdth6 cumdth7 cumdth8 cumdth9 cumdth10 cumdth11 cumdth12 4.2. ;
infile 'c:\abc.dat' dsd truncover;
input casedt1id  contntid country casedt1 cumrep4 cumrep5 cumrep6 cumrep7 cumrep8 dthdtid1 dthcontntid dthdt1 cumdth5 cumdth6 cumdth7 cumdth8 cumdth9 cumdth10 cumdth11 cumdth12 ;
run;

DATA:
137          3.35          Afghanistan                      2009-07-08                                                32        32              99        5.33          2009-10-30                                                                             1         16&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;HI, There you have the code and the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. how to read this second column 3.35 data using w.d format ? I used 4.2 that didn't work now I tried using 4 then again it doesn't work .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;jana&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 13:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490454#M128312</guid>
      <dc:creator>ariyurjana</dc:creator>
      <dc:date>2018-08-28T13:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490470#M128321</link>
      <description>&lt;P&gt;Your data looks to be tab delimited, so use that information rather than explicit position e.g.:&lt;/P&gt;
&lt;PRE&gt;data abc123;
  infile '...' dlm='09'x dsd truncover;
  input casedt1id $ contntid country $ casedt1 cumrep4 cumrep5 cumrep6 cumrep7 cumrep8 dthdtid1 $ dthcontntid dthdt1 cumdth5 cumdth6 cumdth7 cumdth8 cumdth9 cumdth10 cumdth11 cumdth12;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 14:15:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490470#M128321</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-28T14:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490538#M128354</link>
      <description>&lt;P&gt;Remove the cruft, correct the glaring syntax errors, and it will work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc123 replace ;
informat
  casedt1id $3.
  contntid 4.2
  country $32.
  casedt1 yymmdd10.
;
format casedt1 yymmddd10.;
input casedt1id contntid country casedt1;
cards;
137 3.35 Afghanistan 2009-07-08
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have tabs in the infile (which did NOT show up in the code you posted), set them as correct delimiter.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490538#M128354</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-28T16:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490557#M128365</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you mean by "remove cruft&amp;nbsp; " ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used notepad++ to search for tabs and notepad++ returned 0 matches . this file is not tab delimited.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;jana&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 17:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490557#M128365</guid>
      <dc:creator>ariyurjana</dc:creator>
      <dc:date>2018-08-28T17:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490565#M128368</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Checked using notepad++ and this is not a tab delimited file . All the fields are separated by more than ten to 12 blank spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;jana&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 18:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490565#M128368</guid>
      <dc:creator>ariyurjana</dc:creator>
      <dc:date>2018-08-28T18:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490598#M128388</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/213238"&gt;@ariyurjana&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you mean by "remove cruft&amp;nbsp; " ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used notepad++ to search for tabs and notepad++ returned 0 matches . this file is not tab delimited.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards&lt;/P&gt;
&lt;P&gt;jana&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;"cruft" the bad parts of code generating syntax errors: incorrect characters in the informat statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;informat casedt1id&amp;nbsp; :$3. contntid :4.2&lt;STRONG&gt;&lt;FONT color="#ff0000" size="6"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt; country :&lt;STRONG&gt;&lt;FONT color="#ff0000" size="5"&gt;&amp;amp;&lt;/FONT&gt;&lt;/STRONG&gt;$32. casedt1 :yymmdd10.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The characters in red above are &lt;STRONG&gt;errors&lt;/STRONG&gt;. If the file is delimited then the : modifier is likely not needed. Inclusion of a decimal in the informat for numerics may create unexpected values.&lt;/P&gt;
&lt;P&gt;Other errors in the informat are the use of () which is not needed and list of variables followed by an informat is sufficient:&lt;/P&gt;
&lt;P&gt;inform&amp;nbsp; cumrep4 - cumrep8 5. ; would assume that 5 variables get the informat (or format).&lt;/P&gt;
&lt;P&gt;on you INPUT statement if you place variables inside ( ) then there is expected informat or column control information to follow to match. If you have supplied the informat information and are not going to specify column controls then remove the () around variable lits in the Input statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you show did not read &lt;STRONG&gt;any&lt;/STRONG&gt; values from the file but failed. So it is very hard to diagnose a specific issue with some "value"&lt;/P&gt;
&lt;P&gt;There is absolutely NO reason to post a PDF or picture file of the log. Copy the text directly from the log and paste into one of the boxes opened with either the {I} or the "running man". The running man will have some syntax coloring, the {I} is plain text but maintains the positions of the diagnostic characters from the error messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your infile statement does not include any delimiter at all which means that default used&amp;nbsp;is a space. If there are multiple spaces between values then the DSD option on the infile is treating each pair of spaces to indicate a missing value for a variable.&lt;/P&gt;
&lt;P&gt;Below is an example using dlm='|'.&lt;/P&gt;
&lt;P&gt;See what happens to the "numeric" value on the 4th row when there are two delimters before the value.&lt;/P&gt;
&lt;PRE&gt;data example;
   infile datalines dsd dlm='|';
   informat casedt1id  $3. contntid 4.2 country $32.;
   input casedt1id  contntid country;
datalines;
123|456|France 
124| 1234|France
125|3.45|Germany
126||678|USA
;
run;&lt;/PRE&gt;
&lt;P&gt;The example data you posted above&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;137&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.35&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Afghanistan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2009-07-08&amp;nbsp;&lt;/P&gt;
&lt;P&gt;has 10 spaces appearing before the 3.35 value. If the data is NOT tab delimited and actually has 10 spaces then using the DSD option on your infile statement means that the value of 3.35 would be attempted to be read into the eleventh variable on your input statement (if there are that many). 10 more spaces to Afghanistan means that you'll likely have that read into the 21st variable.&lt;/P&gt;
&lt;P&gt;If there are not 10 spaces, then copy a few lines of data from the text file and paste it into a box opened with the {I} to show us.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 19:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490598#M128388</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-28T19:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490700#M128453</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your detailed reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The country name field also has data like the ones below which have embedded blanks which makes the "&amp;amp;" to be used in the informat statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;137          3.35          Afghanistan                                  2009-07-08
101          1.22          Antigua and Barbuda                   2009-06-24
124          2.39          Bosnia and Herzegovina              2009-06-03 
155          4.13          Federated States of Micronesia   2009-07-22
52           1.1            Dominican Republic                       2009-05-29 
9             2.03          Austria                                           2009-04-29
107         3.28          Cambodia                                      2009-06-24 &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;From the above data there are actually 10 or more blank spaces between the columns .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My file has the following characteristics&lt;/P&gt;&lt;P&gt;1. blank is the delimiter&lt;/P&gt;&lt;P&gt;2. there are multiple blanks between columns&lt;/P&gt;&lt;P&gt;3. columns can have missing values but this is not denoted by a missing value&lt;/P&gt;&lt;P&gt;4. numeric data has varying length&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is this kind of file I am trying to read into sas..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, the poster wanted the code and log and since the option was available to upload a file I chose to upload the log as a pdf. Aslo the size of the file was small only 50k. I think I did not commit a super critical error by uploading the log file.Anyway from next time on I will take care not to do the same.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 02:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490700#M128453</guid>
      <dc:creator>ariyurjana</dc:creator>
      <dc:date>2018-08-29T02:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490730#M128477</link>
      <description>&lt;P&gt;This will work for the file as posted:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input
  casedt1id :$3.
  contntid :4.
  country &amp;amp;$32.
  casedt1 :yymmdd10.
;
format casedt1 yymmddd10.;
cards;
137          3.35          Afghanistan                                  2009-07-08
101          1.22          Antigua and Barbuda                   2009-06-24
124          2.39          Bosnia and Herzegovina              2009-06-03 
155          4.13          Federated States of Micronesia   2009-07-22
52           1.1            Dominican Republic                       2009-05-29 
9             2.03          Austria                                           2009-04-29
107         3.28          Cambodia                                      2009-06-24
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that I kept my code to the bare minimum needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Frankly, if someone sends me data like this, I ask them why they stopped their treatments. They should resume ASAP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that in trying to accomodate this galloping foolishness, the responsibility for the correctness of the data in SAS lies on you. But the responsibilty to send data in an unambiguous form should always be with the source of the data. It's not your job to clean other's diapers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 06:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490730#M128477</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-29T06:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: error reading numerical value with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490835#M128553</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to everybody for replying . I am closing this question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will use the column input method to read the data instead of&amp;nbsp; informat method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;jana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 13:31:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-reading-numerical-value-with-decimals/m-p/490835#M128553</guid>
      <dc:creator>ariyurjana</dc:creator>
      <dc:date>2018-08-29T13:31:24Z</dc:date>
    </item>
  </channel>
</rss>

