<?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: &amp;quot;Lost Card&amp;quot; stops process of reading in multiple files with infile filevar in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/453818#M114716</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  infile INDUMMY filevar=ALLPATH obs=317 end=DONE pad;
  do until(DONE or RECNO=18);
    input @1 ANYREC : $4.;       
    RECNO+1;
  end;
  if RECNO=18 then do until(DONE);
    output;
    if DONE then FLAGJET=1;
    else input @1 ANYREC : $4.;
  end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2018 02:26:03 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-04-13T02:26:03Z</dc:date>
    <item>
      <title>"Lost Card" stops process of reading in multiple files with infile filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/453784#M114698</link>
      <description>&lt;P&gt;I am trying to read in data from all of the files from a particular directory.&amp;nbsp; My variable "allpath" specifies the location of each file.&amp;nbsp; I am starting to read each file at observation 18.&amp;nbsp; However, some files do not contain at least 18 lines.&amp;nbsp; What happens is that upon the first occurrence of a file with &amp;lt;18 lines, I receive a "NOTE: LOST CARD." statement and an error message, then the file read-in process stops.&amp;nbsp; I have all of the data read in up to that point output to jtest, but nothing beyond that.&amp;nbsp; I was on the verge of hardcoding to delete those records from "allpath", but I prefer to handle it automatically by having SAS either ignore those files, given the inadequate number of data lines or export a row of missing variables for those files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;QUESTION: How do I keep reading in additional files after having a file without data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;shorine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code (dataset jabc1 contains all of the pathing to the files):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data jtest;&lt;BR /&gt;set jabc1;&lt;BR /&gt;format flagjet 3.;&lt;BR /&gt;do until(done);&lt;BR /&gt;&amp;nbsp; infile indummy filevar=allpath firstobs=18 obs=317 end=done;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; input @1 anyrec $4.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if done then flagjet=1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the error message from my log (there are approx 65 files to read in, so not all are being processed):&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE: LOST CARD.&lt;BR /&gt;subjid=1234 visit=1 task=ABC&lt;BR /&gt;allpath=D:\MYFOLDER\ABC_Subj1234_Visit1_Rep1.txt&lt;/P&gt;&lt;P&gt;flagjet=. done=1 anyrec= _ERROR_=1 _N_=27&lt;BR /&gt;NOTE: There were 27 observations read from the data set WORK.JABC1.&lt;BR /&gt;NOTE: The data set WORK.JTEST has 7204 observations and 6 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An inadequate dataset looks like:&lt;/P&gt;&lt;P&gt;*************************************************************&lt;BR /&gt;2018-04-10 10:18:44 AM&lt;BR /&gt;Subject:1234&lt;BR /&gt;Visit:1&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&amp;#16;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A good dataset looks like:&lt;/P&gt;&lt;P&gt;*************************************************************&lt;BR /&gt;2017-08-17 12:23:50 PM&lt;BR /&gt;Subject:4321&lt;BR /&gt;Visit:1&lt;/P&gt;&lt;P&gt;Criterion1: zz&lt;BR /&gt;Criterion2; d&lt;BR /&gt;Criterion3: w&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;-&lt;BR /&gt;1 d&lt;BR /&gt;2 f&lt;BR /&gt;3 d&lt;BR /&gt;4 c&lt;BR /&gt;5&amp;nbsp;e&lt;/P&gt;&lt;P&gt;... up to 300 records&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 22:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/453784#M114698</guid>
      <dc:creator>shorine</dc:creator>
      <dc:date>2018-04-12T22:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: "Lost Card" stops process of reading in multiple files with infile filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/453818#M114716</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  infile INDUMMY filevar=ALLPATH obs=317 end=DONE pad;
  do until(DONE or RECNO=18);
    input @1 ANYREC : $4.;       
    RECNO+1;
  end;
  if RECNO=18 then do until(DONE);
    output;
    if DONE then FLAGJET=1;
    else input @1 ANYREC : $4.;
  end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 02:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/453818#M114716</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-04-13T02:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: "Lost Card" stops process of reading in multiple files with infile filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/453839#M114727</link>
      <description>&lt;P&gt;Make sure to test the END= variable so that you do not read past the end of any file. Also add the TRUNCOVER option so that trying to read past the end of an individual line does not cause the INPUT statement to try to read another line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data jtest;
  set jabc1;
  infile indummy filevar=allpath truncover obs=317 end=done;
  do _N_=1 to 17 while (not done);
    input; 
  end;
  do while(not done);
    input anyrec $4.;
    flagjet=done ;
    output;
  end;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Apr 2018 06:09:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/453839#M114727</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-13T06:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: "Lost Card" stops process of reading in multiple files with infile filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/454116#M114782</link>
      <description>This code worked. Thanks very much! shorine</description>
      <pubDate>Sat, 14 Apr 2018 05:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/454116#M114782</guid>
      <dc:creator>shorine</dc:creator>
      <dc:date>2018-04-14T05:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: "Lost Card" stops process of reading in multiple files with infile filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/454117#M114783</link>
      <description>I think that this code may work with some small tweaks, but I was not able to get it to work properly.</description>
      <pubDate>Sat, 14 Apr 2018 05:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Lost-Card-quot-stops-process-of-reading-in-multiple-files/m-p/454117#M114783</guid>
      <dc:creator>shorine</dc:creator>
      <dc:date>2018-04-14T05:09:25Z</dc:date>
    </item>
  </channel>
</rss>

