<?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: infile errors in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23238#M3831</link>
    <description>Okay, I solved my problem.  I didn't have a ' ; ' after the list of variables in the input statement.  SAS thought my next line "run;" was another variable without a length and type of variable associated with it.</description>
    <pubDate>Thu, 03 Jul 2008 14:47:12 GMT</pubDate>
    <dc:creator>slb</dc:creator>
    <dc:date>2008-07-03T14:47:12Z</dc:date>
    <item>
      <title>infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23225#M3818</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
I'm importing a .csv data file of around 200 entries, with a lot of variables and many missing values.  When I use the code below, 2 strange things happen:  One, only some of my lines of data are imported, approximately every other one.  Two, the last column in the spreadsheet is entered as if all the data for that variable were missing, when in fact there are few missing data for that variable.  No matter which variable I put in that last column, it always does that.  &lt;BR /&gt;
&lt;BR /&gt;
Help!&lt;BR /&gt;
&lt;BR /&gt;
data soldiers;&lt;BR /&gt;
infile 'Z:\Desktop\Zootermopsis\Caste morph measurements\caste morphological measurements.csv' &lt;BR /&gt;
dlm=',' dsd  firstobs=2;&lt;BR /&gt;
length fixative $ 20 colony $ 50 caste $ 20 eyetype $ 25;&lt;BR /&gt;
input fixative $ cllctnd $ colony $ indiv $ sex $ caste $ whead&lt;BR /&gt;
hdratio lmand llabrum wlabrum lbrmrtio lovary heye midwovry weye nardtest&lt;BR /&gt;
eyetype $ testrat wingbud wwovary narwpost wdtestes wwpost eggs lpost lhead ;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 04 Jun 2008 13:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23225#M3818</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-04T13:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23226#M3819</link>
      <description>Hi gloopy.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Messages from the log may be helpful.  Check to see if you are getting something like: "SAS went to a new line when input reached past end of line".  If so I am guessing the default lrecl is 256.  And it looks like the line you are reading may be longer than that.  On your infile statement add lrecl=512 before the semicolon.</description>
      <pubDate>Wed, 04 Jun 2008 14:09:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23226#M3819</guid>
      <dc:creator>JerryV</dc:creator>
      <dc:date>2008-06-04T14:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23227#M3820</link>
      <description>In the log, the error that it gives is copied below.  All of that first stuff is some of my data, mixed in with the "ZONE" and "NUMR" things...&lt;BR /&gt;
This error is repeated many times, each with different locations listed for the lhead variable 'invalid data'.&lt;BR /&gt;
It doesn't have the error message you mentioned though.  I added in the lrecl statement you suggested and it didn't seem to help--the only change i saw was that SAS only read 55 lines of data instead of 103.  &lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+---&lt;BR /&gt;
2         pampel's,4/20/00,Zn2-9aC,,m,reproductive soldier,0.336,1.131,0.284,0.0775,0.09,0.8611,,0&lt;BR /&gt;
&lt;BR /&gt;
      89  .0425,,0.025,0.0688,unsclerotized,1.3455,0,,0.0675,0.0925,0.1063,,0.255,0.38.pampel's,4/&lt;BR /&gt;
    ZONE  2333322323332323333276766676767662323333232232333323233332323333223233323233076676627232&lt;BR /&gt;
    NUMR  E0425CC0E025C0E0688C5E33C52F49A54C1E3455C0CC0E0675C0E0925C0E1063CC0E255C0E38D01D05C73C4F&lt;BR /&gt;
     177  18/00,Zn2-9,,m,reproductive soldier,0.3063,1.1939,0.2656,0.0738,0.0875,0.8429,,0&lt;BR /&gt;
fixative=pampel's colony=Zn2-9aC caste=reproductive soldier eyetype=unsclerotized cllctnd=4/20/00&lt;BR /&gt;
indiv=  sex=m whead=0.336 hdratio=1.131 lmand=0.284 llabrum=0.0775 wlabrum=0.09 lbrmrtio=0.8611&lt;BR /&gt;
lovary=. heye=0.0425 midwovry=. weye=0.025 nardtest=0.0688 testrat=1.3455 wingbud=0 wwovary=.&lt;BR /&gt;
narwpost=0.0675 wdtestes=0.0925 wwpost=0.1063 eggs=. lpost=0.255 lhead=. _ERROR_=1 _N_=1&lt;BR /&gt;
NOTE: Invalid data for lhead in line 3 178-192.</description>
      <pubDate>Wed, 04 Jun 2008 14:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23227#M3820</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-04T14:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23228#M3821</link>
      <description>Try the MISSOVER option in the INFILE statement.  Missover helps if there is missing values.&lt;BR /&gt;
&lt;BR /&gt;
If that doesn't work try the TRUNCOVER option in the INFILE statement.  I believe that TRUNCOVER works similar to MISSOVER but is a bit different in the details.  And of course you can't use both.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-Darryl</description>
      <pubDate>Wed, 04 Jun 2008 14:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23228#M3821</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2008-06-04T14:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23229#M3822</link>
      <description>hmm, neither missover nor truncover seem to change anything either.... &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;</description>
      <pubDate>Wed, 04 Jun 2008 15:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23229#M3822</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-04T15:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23230#M3823</link>
      <description>The log looks like you don't have any end-of line marker in the .csv file to separate the different records.  Look at the "pampel's" at the end of the second data line; that looks like the same fixative as in the beginning of the first line.</description>
      <pubDate>Wed, 04 Jun 2008 16:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23230#M3823</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2008-06-04T16:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23231#M3824</link>
      <description>I think you may have a data problem or two.&lt;BR /&gt;
&lt;BR /&gt;
Unless I am reading your log wrong, i see the lhead=0.38. which is not a "numeric" the 2 periods will not work.  &lt;BR /&gt;
&lt;BR /&gt;
Also, It looks like there is no end of line marker since 0.38.pampel's run into each other&lt;BR /&gt;
&lt;BR /&gt;
-Darryl</description>
      <pubDate>Wed, 04 Jun 2008 16:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23231#M3824</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2008-06-04T16:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23232#M3825</link>
      <description>Besides missover, I would also try the pad options on the infile statement&lt;BR /&gt;
&lt;BR /&gt;
infile 'Z:\Desktop\Zootermopsis\Caste morph measurements\caste morphological measurements.csv' &lt;BR /&gt;
dlm=',' dsd firstobs=2 pad;</description>
      <pubDate>Thu, 05 Jun 2008 15:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23232#M3825</guid>
      <dc:creator>LAP</dc:creator>
      <dc:date>2008-06-05T15:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23233#M3826</link>
      <description>Sorry - hit the post button too soon.&lt;BR /&gt;
&lt;BR /&gt;
You need to use pad in conjuction with the lrecl= on the infile statement.&lt;BR /&gt;
&lt;BR /&gt;
One other thought,  you may want to inspect the csv file in notepad for any escape characters.  I seem to remember vaguely a similiar issue with a csv file.  I believe I fixed the problem by globally searching (and replacing) the identified character in the csv file</description>
      <pubDate>Thu, 05 Jun 2008 16:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23233#M3826</guid>
      <dc:creator>LAP</dc:creator>
      <dc:date>2008-06-05T16:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23234#M3827</link>
      <description>Are you getting the data from Business Objects by chance?&lt;BR /&gt;
&lt;BR /&gt;
When I used to get BO files, I had to put a dummy variable at the end to control the loss as I could never find the troublesome characters with notepad.</description>
      <pubDate>Fri, 06 Jun 2008 00:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23234#M3827</guid>
      <dc:creator>rab24</dc:creator>
      <dc:date>2008-06-06T00:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23235#M3828</link>
      <description>Have a look at the termstr= option for the infile statement. If the csv-file has been created by a Windows application the termstr should be set to 'CRLF', because Unix only expects the LF as line-separator the CR becomes part of the content.</description>
      <pubDate>Fri, 06 Jun 2008 08:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23235#M3828</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2008-06-06T08:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23236#M3829</link>
      <description>Can anyone help with the following error?  The same error repeats for every other line of data.  For the most part it says the invalid data is the length of the character values up to the space.  The first variable is $30.  &lt;BR /&gt;
&lt;BR /&gt;
NOTE: Invalid data for run in line 3 1-3.&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+-&lt;BR /&gt;
2         ABDR 0.5_12.5_0.5_20          ABDR 0.5/12.5/0.5/20&lt;BR /&gt;
      87                00000000000000   N      77777726724                   19970101&lt;BR /&gt;
     173                                                                      1010314AWP&lt;BR /&gt;
     259                                19990801          20391231               1.89000PLACEBOS&lt;BR /&gt;
     345  **                                                                          1.000&lt;BR /&gt;
     431           0                0.000DummyVar&lt;BR /&gt;
3         ADV BALANCED NUTR SUPP        ADV BALANCED NUTR SUPP&lt;BR /&gt;
      87                00000000000000          21130078170                   20000901&lt;BR /&gt;
     173      O                                                               1010314AWP&lt;BR /&gt;
     259                                20000901          20391231               0.01000PLACEBOS&lt;BR /&gt;
     345  **                                                                          0.000&lt;BR /&gt;
     431           0                0.000DummyVar&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?</description>
      <pubDate>Thu, 03 Jul 2008 14:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23236#M3829</guid>
      <dc:creator>slb</dc:creator>
      <dc:date>2008-07-03T14:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23237#M3830</link>
      <description>Your forgot a semi-colon at the end of your run statement see the error message "invalide data for run..."&lt;BR /&gt;
&lt;BR /&gt;
-Darryl</description>
      <pubDate>Thu, 03 Jul 2008 14:45:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23237#M3830</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2008-07-03T14:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23238#M3831</link>
      <description>Okay, I solved my problem.  I didn't have a ' ; ' after the list of variables in the input statement.  SAS thought my next line "run;" was another variable without a length and type of variable associated with it.</description>
      <pubDate>Thu, 03 Jul 2008 14:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23238#M3831</guid>
      <dc:creator>slb</dc:creator>
      <dc:date>2008-07-03T14:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: infile errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23239#M3832</link>
      <description>Thank you Darryl.</description>
      <pubDate>Thu, 03 Jul 2008 14:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-errors/m-p/23239#M3832</guid>
      <dc:creator>slb</dc:creator>
      <dc:date>2008-07-03T14:49:49Z</dc:date>
    </item>
  </channel>
</rss>

