<?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: Macro String getting too long in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675624#M203582</link>
    <description>&lt;P&gt;try to replace line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let output=%sysfunc(tranwrd(&amp;amp;output.,*n&amp;amp;n.h&amp;amp;h.-,*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let output=%sysfunc(tranwrd(strip(&amp;amp;output.),*n&amp;amp;n.h&amp;amp;h.-,*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it doesn't help&amp;nbsp; replace the double %DO loop with a datastep, writing the formula to file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(like formula.sas) and then do&amp;nbsp;&lt;STRONG&gt;%include "&amp;lt;path&amp;gt;/formula.sas";&lt;/STRONG&gt; in your program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;next may be a help to create the formula without the loops:&lt;/P&gt;
&lt;PRE&gt;73         %let n1h2 = A;
 74         %let n2h2 = B;
 75         %let n1h1 = C;
 76         %let n2h1 = D;
 77         %macro m;
 78         %do h=2 %to 1 %by -1;
 79           %do n=1 %to 2;
 80             %put *n&amp;amp;n.h&amp;amp;h.- , *(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));
 81           %end;
 82         %end;
 83         %mend;
 84         %m;
 *n1h2- , *(A)-))
 *n2h2- , *(B)-))
 *n1h1- , *(C)-))
 *n2h1- , *(D)-))&lt;/PRE&gt;
&lt;P&gt;enter the right values instead A B C D into TRANWRD function and STRIP(each_part);&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you need just 4 lines without loops.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Aug 2020 15:15:39 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2020-08-10T15:15:39Z</dc:date>
    <item>
      <title>Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675596#M203574</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Have*/
%let output=(n1h2_output*n1h2-b3) + (n2h2_output*n2h2-b3);
%let n1h2=(n1h1_n1h2*n1h1-b2) + (n2h1_n1h2*n2h1-b2);
%let n2h2=(n1h1_n2h2*n1h1-b2) + (n2h1_n2h2*n2h1-b2);
%let n1h1=(a_n1h1*a-b1);
%let n2h1=(a_n2h1*a-b1);

%do h=2 %to 1 %by -1;
  %do n=1 %to 2;
    %let output=%sysfunc(tranwrd(&amp;amp;output.,*n&amp;amp;n.h&amp;amp;h.-,*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));
  %end;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem is, the macro string "&lt;STRONG&gt;output&lt;/STRONG&gt;" gets too long.&lt;/P&gt;
&lt;P&gt;I provided a short example here but for me the macro string goes longer than 65K characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Can someone please advise me to code in more efficient/better way?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 21:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675596#M203574</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2020-08-10T21:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675600#M203575</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;you could &lt;A href="https://communities.sas.com/t5/SAS-Programming/Splitting-a-macro-variable-string-into-2/td-p/436668" target="_blank" rel="noopener"&gt;split the variable&lt;/A&gt; or &lt;A href="https://communities.sas.com/t5/SAS-Procedures/How-to-increase-macro-variable-length/td-p/48505" target="_blank" rel="noopener"&gt;write the code to a file&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I'll recommend you to use a dataset to store the results rather than the formulas in macro variables.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 14:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675600#M203575</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2020-08-10T14:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675603#M203576</link>
      <description>&lt;P&gt;It seems that you have entered an endless loop, assigning OUTPUT using loop with &amp;amp;OUTPUT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let output=(n1h2_output*n1h2-b3) + (n2h2_output*n2h2-b3);
   /*======*/
%let n1h2=(n1h1_n1h2*n1h1-b2) + (n2h1_n1h2*n2h1-b2);
%let n2h2=(n1h1_n2h2*n1h1-b2) + (n2h1_n2h2*n2h1-b2);
%let n1h1=(a_n1h1*a-b1);
%let n2h1=(a_n2h1*a-b1);
%do h=2 %to 1 %by -1;
  %do n=1 %to 2;
    %let output=%sysfunc(tranwrd(&amp;amp;output.,*n&amp;amp;n.h&amp;amp;h.-,*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));
       /*=====*/               /*======*/
  %end;
%end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Beyond, it is probably a part of a macro program.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you trying to do?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 14:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675603#M203576</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-10T14:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675604#M203577</link>
      <description>&lt;P&gt;It basically helps me create a big formula. Longer than 65K.&lt;/P&gt;&lt;P&gt;Yes i am using output from previous output. But its not infinite loop it has boundaries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 14:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675604#M203577</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2020-08-10T14:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675624#M203582</link>
      <description>&lt;P&gt;try to replace line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let output=%sysfunc(tranwrd(&amp;amp;output.,*n&amp;amp;n.h&amp;amp;h.-,*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let output=%sysfunc(tranwrd(strip(&amp;amp;output.),*n&amp;amp;n.h&amp;amp;h.-,*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it doesn't help&amp;nbsp; replace the double %DO loop with a datastep, writing the formula to file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(like formula.sas) and then do&amp;nbsp;&lt;STRONG&gt;%include "&amp;lt;path&amp;gt;/formula.sas";&lt;/STRONG&gt; in your program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;next may be a help to create the formula without the loops:&lt;/P&gt;
&lt;PRE&gt;73         %let n1h2 = A;
 74         %let n2h2 = B;
 75         %let n1h1 = C;
 76         %let n2h1 = D;
 77         %macro m;
 78         %do h=2 %to 1 %by -1;
 79           %do n=1 %to 2;
 80             %put *n&amp;amp;n.h&amp;amp;h.- , *(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));
 81           %end;
 82         %end;
 83         %mend;
 84         %m;
 *n1h2- , *(A)-))
 *n2h2- , *(B)-))
 *n1h1- , *(C)-))
 *n2h1- , *(D)-))&lt;/PRE&gt;
&lt;P&gt;enter the right values instead A B C D into TRANWRD function and STRIP(each_part);&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you need just 4 lines without loops.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 15:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675624#M203582</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-10T15:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675635#M203586</link>
      <description>&lt;P&gt;My first option solves the problem:&lt;/P&gt;
&lt;PRE&gt;72         
 73         %macro m;
 74         %let output=(n1h2_output*n1h2-b3) + (n2h2_output*n2h2-b3);
 75         %let n1h2=(n1h1_n1h2*n1h1-b2) + (n2h1_n1h2*n2h1-b2);
 76         %let n2h2=(n1h1_n2h2*n1h1-b2) + (n2h1_n2h2*n2h1-b2);
 77         %let n1h1=(a_n1h1*a-b1);
 78         %let n2h1=(a_n2h1*a-b1);
 79         %do h=2 %to 1 %by -1;
 80           %do n=1 %to 2;
 81             %let output=%sysfunc(tranwrd(strip(&amp;amp;output.),*n&amp;amp;n.h&amp;amp;h.-,*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-));
 82           %end;
 83         %end;
 84         %mend;
 85         %m;
 86         %put OUTPUT=&amp;amp;output;
 OUTPUT=strip(strip(strip(strip((n1h2_output*((n1h1_n1h2*((a_n1h1*a-b1))-b2) + (n2h1_n1h2*((a_n2h1*a-b1))-b2))-b3) + 
 (n2h2_output*((n1h1_n2h2*((a_n1h1*a-b1))-b2) + (n2h1_n2h2*((a_n2h1*a-b1))-b2))-b3)))))
 87  &lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2020 15:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675635#M203586</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-10T15:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675661#M203595</link>
      <description>&lt;P&gt;Thank You&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp; for helping me here.&lt;/P&gt;&lt;P&gt;But the solution you provided is quite similar to what I have(except for the strip function you used.)&lt;/P&gt;&lt;P&gt;The solution that you are suggesting will not work for long strings.&lt;/P&gt;&lt;P&gt;The macro "H" can start from 10 and the macro "N" could go upto 20. As a result the string gets too long.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I &lt;EM&gt;&lt;U&gt;think&lt;/U&gt;&lt;/EM&gt; we have to find a way without creating &lt;STRONG&gt;output&lt;/STRONG&gt; in an iterative fashion and put it out in an external file, which I can later do an include upon(something like formula.sas as per your suggestion)&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 16:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675661#M203595</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2020-08-10T16:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675727#M203615</link>
      <description>&lt;P&gt;You iterate just 2X2=4 times by loops.&lt;/P&gt;
&lt;P&gt;Check the length after each iteration by&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;%let len = %length(&amp;amp;output); %put LAN=&amp;amp;len;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;and check log, does it realy flows out of max possible length;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 19:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675727#M203615</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-10T19:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675778#M203637</link>
      <description>&lt;P&gt;So instead of changing the references to NnHh to the value of &amp;amp;NnHh just change it to a reference instead. Then your macro variables will only grow by one character per reference.&amp;nbsp; Note that you need to change the references in ALL of the macro variables, not just in OUTPUT macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let output=(n1h2_output*n1h2-b3) + (n2h2_output*n2h2-b3);
%let n1h2=(n1h1_n1h2*n1h1-b2) + (n2h1_n1h2*n2h1-b2);
%let n2h2=(n1h1_n2h2*n1h1-b2) + (n2h1_n2h2*n2h1-b2);
%let n1h1=(a_n1h1*a-b1);
%let n2h1=(a_n2h1*a-b1);

data _null_ ;
  length mvar $32 ;
  call symputx('output',tranwrd(symget('output'),'*n','*&amp;amp;n'));
  do h=2 to 1 by -1;
    do n=1 to 2;
      mvar=cats('n',n,'h',h);
      call symputx(mvar,tranwrd(symget(mvar),'*n','*&amp;amp;n'));
    end;
  end;
run;

%put N1H2=%superq(n1h2);
%put N2H2=%superq(n2h2);
%put N1H1=%superq(n1h1);
%put N2H1=%superq(n2h1);
%put OUTPUT=%superq(output);


%put OUTPUT=&amp;amp;output;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Compare the raw and evaluated versions and notice the difference in length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;N1H2=(n1h1_n1h2*&lt;FONT color="#FF0000"&gt;&amp;amp;n1h1&lt;/FONT&gt;-b2) + (n2h1_n1h2*&lt;FONT color="#FF0000"&gt;&amp;amp;n2h1&lt;/FONT&gt;-b2) &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;N2H2=(n1h1_n2h2*&lt;FONT color="#FF0000"&gt;&amp;amp;n1h1&lt;/FONT&gt;-b2) + (n2h1_n2h2*&lt;FONT color="#FF0000"&gt;&amp;amp;n2h1&lt;/FONT&gt;-b2) &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;N1H1=(a_n1h1*a-b1) &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;N2H1=(a_n2h1*a-b1) &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;OUTPUT=(n1h2_output*&lt;FONT color="#FF0000"&gt;&amp;amp;n1h2&lt;/FONT&gt;-b3) + (n2h2_output*&lt;FONT color="#FF0000"&gt;&amp;amp;n2h2&lt;/FONT&gt;-b3)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;OUTPUT=(n1h2_output*(n1h1_n1h2*(a_n1h1*a-b1)-b2) + (n2h1_n1h2*(a_n2h1*a-b1)-b2)-b3) + (n2h2_output*(n1h1_n2h2*(a_n1h1*a-b1)-b2) + (n2h1_n2h2*(a_n2h1*a-b1)-b2)-b3)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note you might need to use regular expression instead of TRANWRD() to find and replace the variable references.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 22:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675778#M203637</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-10T22:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675783#M203641</link>
      <description>&lt;P&gt;Here is RegEx version.&amp;nbsp; Replaces patterns that have *NdHd- with *(&amp;amp;NdHd)-.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  length mvar $32 ;
  rexid = prxparse('s/\*(n\d+h\d+)-/\*(&amp;amp;$1)-/i');
  do h=2 to 1 by -1;
    do n=1 to 2;
      mvar=cats('n',n,'h',h);
      call symputx(mvar,prxchange(rexid,-1,symget(mvar)));
    end;
  end;
  call symputx('output',prxchange(rexid,-1,symget('output')));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2020 23:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675783#M203641</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-10T23:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675909#M203715</link>
      <description>&lt;P&gt;Thank You very much&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;&amp;nbsp;for helping me here.&lt;/P&gt;&lt;P&gt;But I think, Shell Scripting is the solution here:&lt;/P&gt;&lt;P&gt;The reason for that is, eventually the macro string &lt;STRONG&gt;output&amp;nbsp;&lt;/STRONG&gt;is going to be longer than 65K&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
file "/code/location/on/server/formula.sas";
put  "output=" "&amp;amp;output.";
run;

%do h=10 %to 1 %by -1;
%do n=1 %to 20;
	systask 
		command "sed -i 's/*n&amp;amp;n.h&amp;amp;h.-/*(&amp;amp;&amp;amp;n&amp;amp;n.h&amp;amp;h..)-/g' /code/location/on/server/formula.sas"
		wait
		status=status
		shell;
	%put &amp;amp;=status.;
%end;
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Aug 2020 13:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675909#M203715</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2020-08-11T13:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675912#M203718</link>
      <description>&lt;P&gt;Note that using the nested macro variable references I showed the result of evaluating &amp;amp;OUTPUT can be longer than 64K even when the actual length of the macro variable value is not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't really see how calling SED is going to help, but then I don't understand what you are trying to do.&amp;nbsp; It looks like you are generating a formula.&amp;nbsp; So you might use the macro variable to place that formula into some SAS code like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  new_var = &amp;amp;output ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you really expect to execute a formula that is longer than 64K?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 13:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675912#M203718</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-11T13:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro String getting too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675921#M203722</link>
      <description>&lt;P&gt;May be the solution is not by creating a huge macro variable but&amp;nbsp; by splitting it into a set of formulas,&lt;/P&gt;
&lt;P&gt;creating something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;v_tmp1 = &amp;amp;formula1;
v_tmp2 = v_tmp1 * &amp;amp;formula2;
v_tmp3 = v_tmp2 * &amp;amp;formula3;
...etc...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 14:28:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-String-getting-too-long/m-p/675921#M203722</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-11T14:28:21Z</dc:date>
    </item>
  </channel>
</rss>

