<?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 Macro to create scripts with linebreaks in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76420#M16532</link>
    <description>Hi!&lt;BR /&gt;
&lt;BR /&gt;
Is there a wrapper that takes a script as input and outputs the same script but with "smart" linebreaks? &lt;BR /&gt;
&lt;BR /&gt;
I typically upload scripts to a MVS host and would like to have a fixed linesize, however not splitting SAS statements etc.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Wed, 21 Oct 2009 16:40:15 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-21T16:40:15Z</dc:date>
    <item>
      <title>Macro to create scripts with linebreaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76420#M16532</link>
      <description>Hi!&lt;BR /&gt;
&lt;BR /&gt;
Is there a wrapper that takes a script as input and outputs the same script but with "smart" linebreaks? &lt;BR /&gt;
&lt;BR /&gt;
I typically upload scripts to a MVS host and would like to have a fixed linesize, however not splitting SAS statements etc.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Wed, 21 Oct 2009 16:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76420#M16532</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-21T16:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create scripts with linebreaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76421#M16533</link>
      <description>In what form are these scripts stored?</description>
      <pubDate>Wed, 21 Oct 2009 21:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76421#M16533</guid>
      <dc:creator>CurtisMack</dc:creator>
      <dc:date>2009-10-21T21:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create scripts with linebreaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76422#M16534</link>
      <description>And...by "script" do you mean JavaScript? A scripting language like Perl?? Or??? Also, do your "scripts" contain a complete SAS program or SAS program code snippets???&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 21 Oct 2009 22:36:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76422#M16534</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-10-21T22:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create scripts with linebreaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76423#M16535</link>
      <description>By script, I'm assuming you are talking about a SAS program.&lt;BR /&gt;
&lt;BR /&gt;
Anyway, the answer to your question, whatever your script maybe is no.&lt;BR /&gt;
You'll have to code that yourself.&lt;BR /&gt;
&lt;BR /&gt;
A macro with a more or less intelligent behavior could split the content of your files for the 80 char line limit, which exists on MVS.&lt;BR /&gt;
The easiest way to do this would be to parse each line look for the nearest blank char ' ' under the 80 char limit, still this could produce some weird splits (say at the middle of constant value or expression).&lt;BR /&gt;
Another way would be to parse to the nearest blank ' ', or ',' or ';', like the following code:&lt;BR /&gt;
&lt;BR /&gt;
%let LIMIT=80;&lt;BR /&gt;
%let INPUTF=c:\temp\myfile.sas;&lt;BR /&gt;
%let OUTPUTF=c:\temp\myfile_&amp;amp;LIMIT..sas;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
       length INLINE $1024;&lt;BR /&gt;
       infile "&amp;amp;INPUTF";&lt;BR /&gt;
       file "&amp;amp;OUTPUTF";&lt;BR /&gt;
       input;&lt;BR /&gt;
       * under limit no line cut;&lt;BR /&gt;
       if length(_INFILE_) le &amp;amp;LIMIT then put _INFILE_; &lt;BR /&gt;
       else do; * try to cut the line;&lt;BR /&gt;
        INLINE=_INFILE_;&lt;BR /&gt;
        do while (length(INLINE) gt &amp;amp;LIMIT); &lt;BR /&gt;
           I=&amp;amp;LIMIT+1; &lt;BR /&gt;
           DLM='X'; &lt;BR /&gt;
           do while (DLM not in (' ',',',';')); * line delimiters;&lt;BR /&gt;
              I=I-1;&lt;BR /&gt;
              if I = 0 then do;&lt;BR /&gt;
                 put 'no valid delimiters where found, could not process line:';&lt;BR /&gt;
                 put _INFILE_;&lt;BR /&gt;
                 stop;&lt;BR /&gt;
              end; &lt;BR /&gt;
              * cut the line;&lt;BR /&gt;
              DLM=substr(INLINE,I,1); &lt;BR /&gt;
              INLINE=substr(INLINE,1,I); &lt;BR /&gt;
           end; &lt;BR /&gt;
           put INLINE; &lt;BR /&gt;
           INLINE=substr(INLINE,I+1); &lt;BR /&gt;
        end; &lt;BR /&gt;
        * check if the remaining is under limit;&lt;BR /&gt;
        if length(INLINE) le &amp;amp;LIMIT then do; &lt;BR /&gt;
           _INFILE_=INLINE; &lt;BR /&gt;
           output; &lt;BR /&gt;
        end;&lt;BR /&gt;
     end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Thu, 22 Oct 2009 07:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76423#M16535</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-10-22T07:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create scripts with linebreaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76424#M16536</link>
      <description>Dante&lt;BR /&gt;
 &lt;BR /&gt;
for example, see the SAS Sample 30649 last updated earlier this year, at &lt;A href="http://support.sas.com/kb/30/649.html" target="_blank"&gt;http://support.sas.com/kb/30/649.html&lt;/A&gt; &lt;BR /&gt;
Sample 30649: A SAS MACRO to Wrap Text&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Thu, 22 Oct 2009 12:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76424#M16536</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-10-22T12:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create scripts with linebreaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76425#M16537</link>
      <description>Thanks for your input. &lt;BR /&gt;
&lt;BR /&gt;
By script I mean a SAS program just like someone mentioned. The link posted by Peter seems what I'm looking for.</description>
      <pubDate>Thu, 22 Oct 2009 19:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-scripts-with-linebreaks/m-p/76425#M16537</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-22T19:39:04Z</dc:date>
    </item>
  </channel>
</rss>

