<?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: infile with string longer than 32767 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839475#M331920</link>
    <description>&lt;P&gt;The article you linked to is talking about WRITING existing long records to a different file by using the _INFILE_ directive on the PUT statement.&amp;nbsp; There is no _INFILE_ statement.&amp;nbsp; And if the logical record length of the file being read is longer then 32,767 then there will be no _INFILE_ automatic character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to read a value from a file that is longer than what can fit in one variable then you need multiple variables. Either multiple different variables, or multiple observations of the same variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a post that is more appropriate for how to read from a file with a single value that is longer than can be stored in a variable.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-import-a-csv-file-with-a-column-that-exceeds-lrecl-32767/m-p/836805/highlight/true#M330859" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-import-a-csv-file-with-a-column-that-exceeds-lrecl-32767/m-p/836805/highlight/true#M330859&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want more help parsing your existing file then you should share an example of the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Oct 2022 18:41:41 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-10-19T18:41:41Z</dc:date>
    <item>
      <title>infile with string longer than 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839436#M331915</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;I've read your blog post&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Import-text-file-with-string-longer-than-32767/td-p/226063" target="_self"&gt;https://communities.sas.com/t5/SAS-Programming/Import-text-file-with-string-longer-than-32767/td-p/226063&lt;/A&gt;&amp;nbsp;and it comes in very handy.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm exporting via code json files for Visual Analytics reports, they act as copy and transfer vehicle as you can rebuild the report with them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I'm struggling to adapt it to the _infile_ statement.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;The following works&lt;/FONT&gt; (it's only part of tyhe code, I'm aware that you cannot re-run the code like this), but it derails when the string gets longer than 32767, in this case it becomes truncated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    data info;
        length report $128
            path $1024
            content $32767;
        infile content;
        input;
        report="&amp;amp;name";
        path="&amp;amp;path";
        content=_infile_;
    run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Si I've tried without success to adapt it in the following way&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    data info;
        length report $128
            path $1024
            content $32767;
        infile content truncover ;
   array part[10] $32767.;
   input (part[*])($char32767.);
        report="&amp;amp;name";
        path="&amp;amp;path";
        content=_infile_;
    run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get as result the table 'info' with the column 'centent' containing the first 32767 characters of _infile_ and part1 is identical to content, but part2-part10 are empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 17:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839436#M331915</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-10-19T17:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: infile with string longer than 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839450#M331916</link>
      <description>&lt;P&gt;Analyse this:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename content TEMP recfm=n;
data _null_;
file content;

do I=1 to 10;
do l="a","b","c";
  do j= 1 to 32767;
    put l $char1.;
  end;
end;
put '0a'x ;
end;
run;


filename content2 "%sysfunc(pathname(content))" lrecl=1000000000;
data info;
  infile content2 truncover ;
  array part[3] $32767.;
  input (part:) ($char32767.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 17:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839450#M331916</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-10-19T17:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: infile with string longer than 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839452#M331917</link>
      <description>&lt;P&gt;The _infile_ variable, like the rest of the variables is limited to 32K characters.&lt;/P&gt;
&lt;P&gt;You would also have to set a LRECL greater than 32K on the Infile Statement to read more characters to begin with. To read 10 variables of length 32767 you would need Lrecl to be at least 10 times 32767&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;  infile content lrecl=327670 ;&lt;/LI-CODE&gt;
&lt;P&gt;Depending on your operating system and/or the SAS system option LRECL the default length for Lrecl is very likely much less than you need.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 17:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839452#M331917</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-19T17:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: infile with string longer than 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839475#M331920</link>
      <description>&lt;P&gt;The article you linked to is talking about WRITING existing long records to a different file by using the _INFILE_ directive on the PUT statement.&amp;nbsp; There is no _INFILE_ statement.&amp;nbsp; And if the logical record length of the file being read is longer then 32,767 then there will be no _INFILE_ automatic character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to read a value from a file that is longer than what can fit in one variable then you need multiple variables. Either multiple different variables, or multiple observations of the same variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a post that is more appropriate for how to read from a file with a single value that is longer than can be stored in a variable.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-import-a-csv-file-with-a-column-that-exceeds-lrecl-32767/m-p/836805/highlight/true#M330859" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-import-a-csv-file-with-a-column-that-exceeds-lrecl-32767/m-p/836805/highlight/true#M330859&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want more help parsing your existing file then you should share an example of the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 18:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839475#M331920</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-19T18:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: infile with string longer than 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839492#M331924</link>
      <description>&lt;P&gt;Understood, thank you Bart.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76358iA2F8149D8A472708/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic.png" alt="pic.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename content TEMP recfm=n;
data _null_;
file content;

do I=1 to 10;
do l="a","b","c", "d";
  do j= 1 to choosen((l="d")+1, 32767, 5);
    put l $char1.;
  end;
end;
put '0a'x ;
end;
run;


filename content2 "%sysfunc(pathname(content))" lrecl=1000000000;
data info;
  infile content2 truncover ;
  array part[4] $32767.;
  input (part:) ($char32767.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Oct 2022 19:30:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/infile-with-string-longer-than-32767/m-p/839492#M331924</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-10-19T19:30:22Z</dc:date>
    </item>
  </channel>
</rss>

