<?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: PIPE imports only first line in each file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659080#M197481</link>
    <description>I inadvertently copied my code above twice; just refer to one of the snippets.</description>
    <pubDate>Mon, 15 Jun 2020 18:38:04 GMT</pubDate>
    <dc:creator>shl007</dc:creator>
    <dc:date>2020-06-15T18:38:04Z</dc:date>
    <item>
      <title>PIPE imports only first line in each file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659079#M197480</link>
      <description>&lt;P&gt;Hi - I am using a PIPE to import multiple text files. The PIPE does recognize all files in the directory but&amp;nbsp;is only importing the first line in each file? For example, if files A &amp;amp; B are recognized by the pipe, only the first line in A and the first line in B are imported. The file is delimited by '^'. Any ideas why only the first line of each file is imported? Below is the code I am using, including a&amp;nbsp;DO-WHILE loop.&amp;nbsp;I am using this as part of&amp;nbsp;a macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename output pipe %sysfunc(quote(ls -a "&amp;amp;pipepath"*_*.txt));

DATA WORK.testupd;
    INFILE output TRUNCOVER ;
    INPUT name $250.;/*Pull pipe in*/
    fil2read=name;
	INFILE dummy FILEVAR=fil2read END=last FIRSTOBS=1  LENGTH=len truncover
		 /*LRECL=292*/
        ENCODING="LATIN1"
        TERMSTR=CRLF
        DLM='^' 
        MISSOVER
        DSD ;

    LENGTH
        F1               $ 28	/* field1*/
        F2               $ 1	/* field2 */
        F3               $ 8  /* field3 */
        F4               $ 10  /* field4 */
        F5               $ 60	/* field5 */
        F6               $ 50	/* field6 */
;
    FORMAT
        F1               $CHAR28.
        F2               $CHAR1.
        F3               $CHAR8.
        F4               $CHAR10.
        F5               $CHAR60.
        F6               $CHAR50.
;
    INFORMAT
        F1               $CHAR28.
        F2               $CHAR1.
        F3               $CHAR8.
        F4               $CHAR10.
        F5               $CHAR60.
        F6               $CHAR50.
 ;
	do while (not last);
	INPUT
        F1               : $CHAR28.
        F2               : $CHAR1.
        F3               : $CHAR8.
        F4               : $CHAR10.
        F5               : $CHAR60.
        F6               : $CHAR50.
;
		Rundt  = today();
		format Rundt date10.;

		filenm = fil2read;

		output;
	end;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.testupd;
    INFILE output TRUNCOVER ;
    INPUT name $250.;/*Pull pipe in*/
    fil2read=name;
	INFILE dummy FILEVAR=fil2read END=last FIRSTOBS=1  LENGTH=len truncover
		 /*LRECL=292*/
        ENCODING="LATIN1"
        TERMSTR=CRLF
        DLM='^' 
        MISSOVER
        DSD ;

    LENGTH
        F1               $ 28	/* field1 */
        F2               $ 1	/* field2*/
        F3               $ 8  /* field3*/
        F4               $ 10  /* field4 */
        F5               $ 60	/* field5 */
;
    FORMAT
        F1               $CHAR28.
        F2               $CHAR1.
        F3               $CHAR8.
        F4               $CHAR10.
        F5               $CHAR60.
;
    INFORMAT
        F1               $CHAR28.
        F2               $CHAR1.
        F3               $CHAR8.
        F4               $CHAR10.
        F5               $CHAR60.
;
	do while (not last);
	INPUT
        F1               : $CHAR28.
        F2               : $CHAR1.
        F3               : $CHAR8.
        F4               : $CHAR10.
        F5               : $CHAR60.
;
		Rundt  = today();
		format Rundt date10.;

		filenm = fil2read;

		output;
	end;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2020 18:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659079#M197480</guid>
      <dc:creator>shl007</dc:creator>
      <dc:date>2020-06-15T18:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: PIPE imports only first line in each file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659080#M197481</link>
      <description>I inadvertently copied my code above twice; just refer to one of the snippets.</description>
      <pubDate>Mon, 15 Jun 2020 18:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659080#M197481</guid>
      <dc:creator>shl007</dc:creator>
      <dc:date>2020-06-15T18:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: PIPE imports only first line in each file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659090#M197485</link>
      <description>&lt;P&gt;You are working on UNIX. Are you sure the files use the Windows line separator CRLF, and not the UNIX-typical LF?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 19:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659090#M197485</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-15T19:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: PIPE imports only first line in each file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659122#M197502</link>
      <description>&lt;P&gt;Hi Kurt - not sure to your question. How can I tell which LF character is being used? If it is using a different-than-expected LF character, is there a way I can account for that in the code? Thanks for any tips!!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 20:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659122#M197502</guid>
      <dc:creator>shl007</dc:creator>
      <dc:date>2020-06-15T20:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: PIPE imports only first line in each file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659124#M197504</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/216466"&gt;@shl007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Kurt - not sure to your question. How can I tell which LF character is being used? If it is using a different-than-expected LF character, is there a way I can account for that in the code? Thanks for any tips!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your code shows the option TERMSTR=CRLF. Which tells SAS to read the file with the Windows standard CarriageReturn/LineFeed character combination as the end of line marker. This is an operating system default. If the file is actually a UNIX file which would use LF as the end of line marker then you have told the program with the CRLF that there is only one line. If the LF should be the end of line character than either use Termstr=LF or remove the Termstr option entirely which will then use the default for the operating system involved.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 20:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659124#M197504</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-15T20:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: PIPE imports only first line in each file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659125#M197505</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/216466"&gt;@shl007&lt;/a&gt;&amp;nbsp; - What happens if you remove TERMSTR=CRLF?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 20:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PIPE-imports-only-first-line-in-each-file/m-p/659125#M197505</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-06-15T20:38:21Z</dc:date>
    </item>
  </channel>
</rss>

