<?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: why does recfm=n work in this example? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605840#M175846</link>
    <description>&lt;P&gt;I don't really know the details of how SAS reads/buffers data, but I suspect it is a little more complex than your description.&amp;nbsp; It is probably reading/buffering the data from the disk and then staging/parsing that for the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a maximum record length for when SAS is parsing the data into records for you, but it is not 32k.&amp;nbsp; That is just the default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when you use RECFM=N then it is NOT parsing the data into records for you.&amp;nbsp; It is just giving you the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use RECFM=F then it splits the records as fixed length.&amp;nbsp; If you use RECFM=V then it looks for end of record character(s) (see TERMSTR= option) to parse the data into records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 16:55:07 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-11-20T16:55:07Z</dc:date>
    <item>
      <title>why does recfm=n work in this example?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605746#M175811</link>
      <description>&lt;P&gt;In (example 5, page 12) of the following document&amp;nbsp;&lt;A title=" SPLITTING DATA INTO MULTIPLE VARIABLES CONDITIONALLY " href="http://support.sas.com/resources/papers/proceedings11/256-2011.pdf" target="_self"&gt;Paper 256-2011: Finding Your Way Through the Wilderness&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;shows how recfm=n can be used to read lines longer than 32,767 characters, byte by byte.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I don't get is why the record was not trimmed to 32,767 which would be the default lrecl as the values was not explicitly assigned. I believe that my confusion could be caused by misunderstanding of how SAS 'buffering' works while reading files: as I understand it, infile puts data from the file into a "buffer" (which cannot be longer than 32,767 characters) and input puts data from the buffer into SAS variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile 'c:\_today\claude.csv' recfm=n;
file 'c:\_today\claude_.csv' recfm=n;
input a $char1.;
put a $char1.;
if a = ',' then c+1;
if c=3 then do;
 d+1;
 if d=32767 then put ',';
end;
if c=4 then do;
 if d&amp;lt;32767 then put ',';
 d=32768;
end;
if c=5 then do;
 d=0;
 c=0;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 14:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605746#M175811</guid>
      <dc:creator>franriv</dc:creator>
      <dc:date>2019-11-20T14:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: why does recfm=n work in this example?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605758#M175815</link>
      <description>&lt;P&gt;recfm=n means that the input is read as a stream (there are no records), and for each input the required number of bytes is read; the input buffer has an effective length of 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 14:52:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605758#M175815</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T14:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: why does recfm=n work in this example?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605840#M175846</link>
      <description>&lt;P&gt;I don't really know the details of how SAS reads/buffers data, but I suspect it is a little more complex than your description.&amp;nbsp; It is probably reading/buffering the data from the disk and then staging/parsing that for the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a maximum record length for when SAS is parsing the data into records for you, but it is not 32k.&amp;nbsp; That is just the default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when you use RECFM=N then it is NOT parsing the data into records for you.&amp;nbsp; It is just giving you the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use RECFM=F then it splits the records as fixed length.&amp;nbsp; If you use RECFM=V then it looks for end of record character(s) (see TERMSTR= option) to parse the data into records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605840#M175846</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-20T16:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: why does recfm=n work in this example?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605846#M175849</link>
      <description>&lt;P&gt;I was wrong in a certain way, as with recfm=n SAS does not have an input buffer at all; _infile_ does not work with recfm=n, and SAS simply reads as many bytes as requested from the input stream.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 17:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-does-recfm-n-work-in-this-example/m-p/605846#M175849</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T17:22:14Z</dc:date>
    </item>
  </channel>
</rss>

