<?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: Importing External Files (*.LST) into an ODS Document - preserving pagebreak. in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/690646#M24564</link>
    <description>&lt;P&gt;I tried the code and see there may be a problem in the way ODS is reading text files using proc document &lt;EM&gt;import to&lt;/EM&gt; statement - it doesn't recognize page breaks. You can see this if you use the &lt;EM&gt;list / levels=all details&lt;/EM&gt; statement, which is supposed to show page breaks, if any, in the textfile being read.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To go around this issue, we can use multiple replay statements like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file="out.pdf";
proc document name=import(write);
    import textfile="odsglm.lst" to ^;
    obpage \textfile / after;                /*optional, seems to be working even without*/
   &lt;FONT size="2" color="#FF0000"&gt; &lt;STRONG&gt;replay textfile(where=(_obs_&amp;lt;14));       /*Inside Macro*/
    replay textfile(where=(14&amp;lt;=_obs_&amp;lt;40));   /*Inside Macro*/&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;STRONG&gt;    ....etc...                               /*Inside Macro*/&lt;/STRONG&gt;&lt;/FONT&gt;
run; quit;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The lines above with the comment "Inside Macro" can be easily macrotized if you know the exact lines where the page-breaks (HEX code '0C'x) are. This can be done using a simple data step like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
    retain i 0;
    infile "odsglm.lst" truncover;
    input first $;
    if substr(first,1,1)='0C'x then do; /*If first character is page break, then create macro variable*/
        i=i+1;
        call symput("pos"||strip(put(i, best.)), _N_);
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vellad_0-1602312135447.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50518i8A6EC3EABFEF1EE4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vellad_0-1602312135447.png" alt="vellad_0-1602312135447.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Oct 2020 06:45:00 GMT</pubDate>
    <dc:creator>vellad</dc:creator>
    <dc:date>2020-10-10T06:45:00Z</dc:date>
    <item>
      <title>Importing External Files (*.LST) into an ODS Document - preserving pagebreak.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/680438#M24382</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does anyone know how to preserve the page break when importing a Listing file into ODS?? I am using the following code -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods pdf;&lt;BR /&gt;proc document name=import(write);&lt;BR /&gt;import textfile="odsglm.lst" to ^;&lt;BR /&gt;list/ details; &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ods pdf close;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Despite also using an LST file in the example, the example on the SAS website also does not preserve the page breaks -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=odsproc&amp;amp;docsetTarget=n1m49jyc3pkuz6n1k4qrgo8hszn3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=odsproc&amp;amp;docsetTarget=n1m49jyc3pkuz6n1k4qrgo8hszn3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 14:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/680438#M24382</guid>
      <dc:creator>RichardP</dc:creator>
      <dc:date>2020-08-31T14:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Importing External Files (*.LST) into an ODS Document - preserving pagebreak.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/690646#M24564</link>
      <description>&lt;P&gt;I tried the code and see there may be a problem in the way ODS is reading text files using proc document &lt;EM&gt;import to&lt;/EM&gt; statement - it doesn't recognize page breaks. You can see this if you use the &lt;EM&gt;list / levels=all details&lt;/EM&gt; statement, which is supposed to show page breaks, if any, in the textfile being read.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To go around this issue, we can use multiple replay statements like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file="out.pdf";
proc document name=import(write);
    import textfile="odsglm.lst" to ^;
    obpage \textfile / after;                /*optional, seems to be working even without*/
   &lt;FONT size="2" color="#FF0000"&gt; &lt;STRONG&gt;replay textfile(where=(_obs_&amp;lt;14));       /*Inside Macro*/
    replay textfile(where=(14&amp;lt;=_obs_&amp;lt;40));   /*Inside Macro*/&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;STRONG&gt;    ....etc...                               /*Inside Macro*/&lt;/STRONG&gt;&lt;/FONT&gt;
run; quit;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The lines above with the comment "Inside Macro" can be easily macrotized if you know the exact lines where the page-breaks (HEX code '0C'x) are. This can be done using a simple data step like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
    retain i 0;
    infile "odsglm.lst" truncover;
    input first $;
    if substr(first,1,1)='0C'x then do; /*If first character is page break, then create macro variable*/
        i=i+1;
        call symput("pos"||strip(put(i, best.)), _N_);
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vellad_0-1602312135447.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50518i8A6EC3EABFEF1EE4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vellad_0-1602312135447.png" alt="vellad_0-1602312135447.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2020 06:45:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/690646#M24564</guid>
      <dc:creator>vellad</dc:creator>
      <dc:date>2020-10-10T06:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Importing External Files (*.LST) into an ODS Document - preserving pagebreak.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/690790#M24567</link>
      <description>&lt;P&gt;aha...yes..it took me a while to understand your solution but now I get it. So the 'replay' statement is forcing a page break. Very nice. I will give this a try, many thank!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 14:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/690790#M24567</guid>
      <dc:creator>RichardP</dc:creator>
      <dc:date>2020-10-11T14:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Importing External Files (*.LST) into an ODS Document - preserving pagebreak.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/690803#M24568</link>
      <description>Anytime!</description>
      <pubDate>Sun, 11 Oct 2020 17:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Importing-External-Files-LST-into-an-ODS-Document-preserving/m-p/690803#M24568</guid>
      <dc:creator>vellad</dc:creator>
      <dc:date>2020-10-11T17:32:59Z</dc:date>
    </item>
  </channel>
</rss>

