<?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: How lrecl option in infile statement works? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773256#M245613</link>
    <description>&lt;P&gt;Correct. RECFM=F with LRECL=1 makes each byte a record. Each INPUT will read exactly one byte.&lt;/P&gt;</description>
    <pubDate>Sun, 10 Oct 2021 08:52:02 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-10-10T08:52:02Z</dc:date>
    <item>
      <title>How lrecl option in infile statement works?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773252#M245609</link>
      <description>&lt;P&gt;I use a segment of code from the paper 052-2009&amp;nbsp; written by Rick Langston in SAS Global Forum 2009 to creating text file from HTML. The codes read&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename in url 'https://www.zaobao.com/realtime/china/story20211010-1201937';
filename out 'd:\mydata\myfile.txt';
data _null_;
infile in lrecl=1 recfm=f end=eof;
file out lrecl=1 recfm=f;
input @1 x $char1.;
put @1 x $char1.;
if eof;
call symputx('filesize',_n_);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm puzzled by then followings:&lt;/P&gt;
&lt;P&gt;1)What's a data line of input HTML file? Do options lrecl=1 recfm=m in infile statement let input statement read atmost one character each time?&lt;/P&gt;
&lt;P&gt;2)How Does&amp;nbsp;input statement read a Chinese character into variable x, Since&amp;nbsp; the informt $char1. makes it read one character eacht time?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) I want create sas data set using the code&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename in url 'https://www.zaobao.com/realtime/china/story20211010-1201937';
filename out 'd:\mydata\myfile.txt';
data  dst;
infile in lrecl=1 recfm=f end=eof;
file out lrecl=1 recfm=f;
input @1 x $char1.;
put @1 x $char1.;
if eof;
call symputx('filesize',_n_);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The SAS dataset dst only has on observation with missing value. Why?&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 13:42:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773252#M245609</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2021-10-10T13:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: How lrecl option in infile statement works?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773253#M245610</link>
      <description>&lt;P&gt;RECFM=F means records of a fixed length, any line-ending character or sequence (LF, CR, CRLF) is disregarded and in fact read as bytes.&lt;/P&gt;
&lt;P&gt;LRECL=1 means to&amp;nbsp;&lt;EM&gt;always&lt;/EM&gt; read one character as one record. UTF characters will be read peacemeal, each of their constituent bytes separately.&lt;/P&gt;
&lt;P&gt;Your code defines a boolean variable (eof) for the end of input data which will be set to true when the last byte is read. Since you use it in a &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/p1cxl8ifdt8u0gn12wqbji8o5fq1.htm" target="_blank" rel="noopener"&gt;Subsetting IF&lt;/A&gt;, only that byte will end up in the dataset. But your code will write all web data to the text file (because the INPUT/PUT happen before the subsetting IF).&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 07:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773253#M245610</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-10T07:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: How lrecl option in infile statement works?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773254#M245611</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Another question:&lt;/P&gt;
&lt;P&gt;To my knowledge, input statement reads one character of the current dataline in current data-step loop,and read one character of the next dataline in the next loop without a double trailing @@. Is it right that input statement take each character as a seperate dataline since&amp;nbsp; &lt;SPAN&gt;any line-ending character or sequence (LF, CR, CRLF) is disregarded&amp;nbsp;&lt;/SPAN&gt;?&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 08:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773254#M245611</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2021-10-10T08:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: How lrecl option in infile statement works?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773256#M245613</link>
      <description>&lt;P&gt;Correct. RECFM=F with LRECL=1 makes each byte a record. Each INPUT will read exactly one byte.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 08:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-lrecl-option-in-infile-statement-works/m-p/773256#M245613</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-10T08:52:02Z</dc:date>
    </item>
  </channel>
</rss>

