<?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: Override space as delimiter in reading text files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/m-p/743882#M232989</link>
    <description>&lt;P&gt;You don't need to mess with the delimiter to read a full line.&lt;/P&gt;
&lt;P&gt;Just use formatted input.&amp;nbsp; Use the TRUNCOVER infile option to handle short lines. Use the $CHAR informat to preserve any leading spaces on the line.&lt;/P&gt;
&lt;P&gt;Or just use the _INFILE_ automatic variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA TEMPFILE ;
  ATTRIB TEMPLINE LENGTH = $200 ;
  INFILE "C:\TEMP.TXT" TRUNCOVER;
  INPUT TEMPLINE $char200.;
RUN ;  

DATA TEMPFILE ;
  ATTRIB TEMPLINE LENGTH = $200 ;
  INFILE "C:\TEMP.TXT" ;
  INPUT ;
  TEMPLINE= _infile_;
RUN ;  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 May 2021 14:58:31 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-05-26T14:58:31Z</dc:date>
    <item>
      <title>Override space as delimiter in reading text files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/m-p/743879#M232987</link>
      <description>&lt;P&gt;When reading a text file using the INFILE statement, the documentation tells me that the delimiter between variables is a space.&amp;nbsp; &amp;nbsp;However, I want to read an entire line of text that contains spaces - as a single variable.&amp;nbsp; I believe to override the space delimiter, I need to use the delimiter= option on the INFILE statement.&amp;nbsp; &amp;nbsp;However, I can't seem to find the right character(s) to override the default.&amp;nbsp; I've used DLM=''&amp;nbsp; &amp;nbsp;and DLM='&lt;SPAN&gt;0x0D'x&amp;nbsp; &amp;nbsp;and DLM=CRLF&amp;nbsp; &amp;nbsp;all without the result I need.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My current program looks like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA&amp;nbsp;TEMPFILE ;&lt;/P&gt;&lt;P&gt;ATTRIB&amp;nbsp;TEMPLINE&amp;nbsp;LENGTH = $200&amp;nbsp;;&lt;/P&gt;&lt;P&gt;INFILE&amp;nbsp;"C:\TEMP.TXT"&amp;nbsp;DELIMITER = '0x0D'x&amp;nbsp;;&amp;nbsp; &amp;nbsp;/*&amp;nbsp; &amp;nbsp;or&amp;nbsp;DELIMITER = ''&amp;nbsp; &amp;nbsp;*/&amp;nbsp;&lt;/P&gt;&lt;P&gt;INPUT&amp;nbsp;TEMPLINE ;&lt;/P&gt;&lt;P&gt;RUN ;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where TEMP.TXT is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FIRSTWORD SECONDWORD MOREWORDS&lt;/P&gt;&lt;P&gt;THISISAVERYLONG WORD&lt;/P&gt;&lt;P&gt;TEST!TEST@TEST# test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The program only grabs the data before the first space. I can't seem to override this.&amp;nbsp; I know I'm simply missing some option but I can't seem to find it reading the documentation or googling for examples.&amp;nbsp; Thanx in advance...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 13:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/m-p/743879#M232987</guid>
      <dc:creator>jonthiele</dc:creator>
      <dc:date>2021-05-26T13:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Override space as delimiter in reading text files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/m-p/743882#M232989</link>
      <description>&lt;P&gt;You don't need to mess with the delimiter to read a full line.&lt;/P&gt;
&lt;P&gt;Just use formatted input.&amp;nbsp; Use the TRUNCOVER infile option to handle short lines. Use the $CHAR informat to preserve any leading spaces on the line.&lt;/P&gt;
&lt;P&gt;Or just use the _INFILE_ automatic variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA TEMPFILE ;
  ATTRIB TEMPLINE LENGTH = $200 ;
  INFILE "C:\TEMP.TXT" TRUNCOVER;
  INPUT TEMPLINE $char200.;
RUN ;  

DATA TEMPFILE ;
  ATTRIB TEMPLINE LENGTH = $200 ;
  INFILE "C:\TEMP.TXT" ;
  INPUT ;
  TEMPLINE= _infile_;
RUN ;  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 14:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/m-p/743882#M232989</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-26T14:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Override space as delimiter in reading text files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/m-p/743912#M232995</link>
      <description>Thanx Tom for the very(!) quick reply. This worked perfectly and is exactly what I needed.&lt;BR /&gt;Appreciated!!!</description>
      <pubDate>Wed, 26 May 2021 15:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/m-p/743912#M232995</guid>
      <dc:creator>jonthiele</dc:creator>
      <dc:date>2021-05-26T15:04:25Z</dc:date>
    </item>
  </channel>
</rss>

