<?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 to put multiple %let MVar=x lines into one Macro Variable/Line?! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977332#M378474</link>
    <description>&lt;P&gt;First, could you explain more why you need such multiple assignments? It seems to be rather "unusual" strategy for creating macro variables. I personally would seriously reconsider such design.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, one way to do it would be to go with CALL SYMPUTX() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputX("logicx", '%let wtcalc1= abs(a/b-1)*weight;%let wtcalc2=(abs(a/b+c*0.2)*weight;%let wtcalc3=(abs(a/b+c*0.4)*weight;', "G");	
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice the string is in SINGLE quotes!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course now previewing value of LOGICX may be a bit tricky. If you run just:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;logicx.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you will get only a bunch of:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: Open code statement recursion detected.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;messages!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To preview the value, remember to properly mask LOGICX, for example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %superq(logicx);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(notice there is no &amp;amp; there). Result in the log will be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1    %put %superq(logicx);
%let wtcalc1= abs(a/b-1)*weight;%let wtcalc2=(abs(a/b+c*0.2)*weight;%let wtcalc3=(abs(a/b+c*0.4)*weight;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other option would be to use macro quoting function %NRSTR(), for example like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let logicx= %NRSTR(%%let) wtcalc1=abs(a/b-1)*weight %NRSTR(; %%let) wtcalc2=(abs(a/b+c*0.2)*weight %NRSTR(; %%let) wtcalc3=(abs(a/b+c*0.4)*weight%str(;) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice that inside %NRSTR() percent symbols have to be escaped with double: %%&lt;/P&gt;
&lt;P&gt;To preview value the %SUPERQ() will work, but to call the macro variable and get the masked value "runnable" you will have to unmask it with %UNQUOTE() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%unquote(&amp;amp;logicx.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I wrote, I would not go with any of those strategies. But, unless you share your motivation, I cannot propose other strategy too...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Sat, 18 Oct 2025 17:48:24 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2025-10-18T17:48:24Z</dc:date>
    <item>
      <title>How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977312#M378468</link>
      <description>&lt;P&gt;I have multiple Macro Variable Assignment Lines, such as below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let wtcalc1= abs(a/b-1)*weight; 					
%let wtcalc2=(abs(a/b+c*0.2)*weight;					
%let wtcalc3=(abs(a/b+c*0.4)*weight;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Appearantly direct assignment does not work, such as below, with ot without " ".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let logicx="%let wtcalc1= abs(a/b-1)*weight; 					
%let wtcalc2=(abs(a/b+c*0.2)*weight;					
%let wtcalc3=(abs(a/b+c*0.4)*weight;";	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How to make it work, to assign into a single macro variable/line?!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case why I am doing this? I need put 'em into one line/macro variable and then attach it&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to the output dataset. That allows me backtrack what logic indeed is used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Oct 2025 05:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977312#M378468</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-10-18T05:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977313#M378469</link>
      <description>&lt;P&gt;Also I need run with inside the Macro. The code below saves the information. But without "%let"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and cannot be used inside the macro.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let wtcalc1= abs(a/b-1)*weight; 					
%let wtcalc2=(abs(a/b+c*0.2)*weight;					
%let wtcalc3=(abs(a/b+c*0.4)*weight;

%let logicx=wtcalc1=&amp;amp;wtcalc1 wtcalc2=&amp;amp;wtcalc2 wtcalc3=&amp;amp;wtcalc3;

%put "&amp;amp;logicx.";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Oct 2025 05:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977313#M378469</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-10-18T05:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977316#M378470</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for what you have shared, but it would be helpful to share more information for context. For example, you have not shown us any error message you receive so considering sharing a log (using the Insert Code icon "&amp;lt;/&amp;gt;") that shows how the macro assignments are being used and what errors / warnings this brings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values assigned to macro variables wtcalc2 and 3 have unbalanced brackets, so this might be the root cause of your issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let wtcalc1= abs(a/b-1)*weight;          
%let wtcalc2=(abs(a/b+c*0.2)*weight;          
%let wtcalc3=(abs(a/b+c*0.4)*weight;

%put &amp;amp;=wtcalc1;
%put &amp;amp;=wtcalc2;
%put &amp;amp;=wtcalc3;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which gave the following log, with no issues:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 72         %let wtcalc1= abs(a/b-1)*weight;
 73         %let wtcalc2=(abs(a/b+c*0.2)*weight;
 74         %let wtcalc3=(abs(a/b+c*0.4)*weight;
 75         
 76         %put &amp;amp;=wtcalc1;
 WTCALC1=abs(a/b-1)*weight
 77         %put &amp;amp;=wtcalc2;
 WTCALC2=(abs(a/b+c*0.2)*weight
 78         %put &amp;amp;=wtcalc3;
 WTCALC3=(abs(a/b+c*0.4)*weight
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try fixing the brackets, and if that doesn't work then share a log showing your code with the error / warning messages and separately explain what result you do want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Oct 2025 10:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977316#M378470</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2025-10-18T10:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977323#M378471</link>
      <description>&lt;P&gt;Agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22588"&gt;@Amir&lt;/a&gt;&amp;nbsp;- more context would be helpful.&amp;nbsp; I'm not sure what you mean by "attach it to the output dataset".&amp;nbsp; Do you mean as a dataset label?&amp;nbsp; As a variable that contains this text string as a value?&amp;nbsp; Also, if you actually have 3 variables in your data called, for example, wt1, wt2, wt3, you could instead store these equations as the labels for those variables, i.e.,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;label
    wt1="abs(a/b-1)*weight"
    wt2="(abs(a/b+c*0.2)*weight"
    wt3="(abs(a/b+c*0.4)*weight"
    ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;...but again, it's hard to tell what you're trying to achieve.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Oct 2025 11:10:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977323#M378471</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-10-18T11:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977324#M378472</link>
      <description>&lt;P&gt;If &lt;EM&gt;attach to the output dataset&lt;/EM&gt; means storing it in a variable of this dataset then below is a straightforward way of achieving this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set sashelp.class end=last;
  length my_logic $400;
  if last then
    do;
      my_logic=cats('%let wtcalc1=',"&amp;amp;wtcalc1;",'%let wtcalc2=',"&amp;amp;wtcalc2;",'%let wtcalc3=',"&amp;amp;wtcalc3;");
    end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Oct 2025 11:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977324#M378472</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-10-18T11:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977332#M378474</link>
      <description>&lt;P&gt;First, could you explain more why you need such multiple assignments? It seems to be rather "unusual" strategy for creating macro variables. I personally would seriously reconsider such design.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, one way to do it would be to go with CALL SYMPUTX() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputX("logicx", '%let wtcalc1= abs(a/b-1)*weight;%let wtcalc2=(abs(a/b+c*0.2)*weight;%let wtcalc3=(abs(a/b+c*0.4)*weight;', "G");	
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice the string is in SINGLE quotes!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course now previewing value of LOGICX may be a bit tricky. If you run just:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;logicx.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you will get only a bunch of:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: Open code statement recursion detected.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;messages!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To preview the value, remember to properly mask LOGICX, for example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %superq(logicx);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(notice there is no &amp;amp; there). Result in the log will be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1    %put %superq(logicx);
%let wtcalc1= abs(a/b-1)*weight;%let wtcalc2=(abs(a/b+c*0.2)*weight;%let wtcalc3=(abs(a/b+c*0.4)*weight;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other option would be to use macro quoting function %NRSTR(), for example like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let logicx= %NRSTR(%%let) wtcalc1=abs(a/b-1)*weight %NRSTR(; %%let) wtcalc2=(abs(a/b+c*0.2)*weight %NRSTR(; %%let) wtcalc3=(abs(a/b+c*0.4)*weight%str(;) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice that inside %NRSTR() percent symbols have to be escaped with double: %%&lt;/P&gt;
&lt;P&gt;To preview value the %SUPERQ() will work, but to call the macro variable and get the masked value "runnable" you will have to unmask it with %UNQUOTE() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%unquote(&amp;amp;logicx.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I wrote, I would not go with any of those strategies. But, unless you share your motivation, I cannot propose other strategy too...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Sat, 18 Oct 2025 17:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977332#M378474</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-10-18T17:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977333#M378475</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;In case why I am doing this? I need put 'em into one line/macro variable and then attach it&lt;/P&gt;
&lt;P&gt;to the output dataset. That allows me backtrack what logic indeed is used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Lots of good ideas above. Most of them involving explaining to us in a lot more detail, or re-inventing the process. You would be wise to follow that advice. As with one of your earlier threads&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/409584"&gt;@hellohere&lt;/a&gt;&amp;nbsp;there's too much here that makes no sense or are red flags.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally, my advice is that &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;code&amp;nbsp; generally doesn't belong in datasets&lt;/STRONG&gt;&lt;/FONT&gt;, which is another reason to explain more and another reason to consider a different process. And furthermore, I can't see a reason to store code in datasets that doesn't work at all because of imbalanced parentheses).&lt;/P&gt;</description>
      <pubDate>Sat, 18 Oct 2025 18:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977333#M378475</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-10-18T18:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977334#M378476</link>
      <description>&lt;P&gt;You seemed to have skipped explaining a lot of the steps here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have macro variables that exist and you want to retrieve their values you can either just reference them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;my_ds_variable = "&amp;amp;my_macro_variable";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could use SYMGET() function.&amp;nbsp; Which would work better for a lot of macro variables since the name could come from an expression.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length mvar $32 value $200;
do 1=1 to 3;
  mvar=cats('wtcalc',i);
  value = symget(mvar);
  output;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just just reference SASHELP.VMACRO.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set sashelp.vmacro;
where name=: 'WTCALC' ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you really want to generate that strange macro variable you could do it like this (as long as the macro values do not exceed 200 bytes).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select catx('=',name,value) into :logicx separated by ';%let '
  from dictionary.macros
  where name eqt 'WTCALC'
;
quit;
%let logicx=%nrstr(%let )%superq(logicx)%str(;) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If they do then perhaps use a data step instead so you can use SYMGET() to get the full value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  length logicx $4000 ;
  retain logicx;
  set sashelp.vmacro end=eof;
  where name =: 'WTCALC' and offset=0;
  logicx=cats(logicx,catx(' ','%let',name),'=',symget(name),';');
  if eof then call symputx('logicx',logicx);
run;
%let logicx=%superq(logicx);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But why put this into a macro variable if the goal is to put it into data??&lt;/P&gt;</description>
      <pubDate>Sat, 18 Oct 2025 20:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977334#M378476</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-10-18T20:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977338#M378477</link>
      <description>&lt;P&gt;Thanks for the attention.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's forget the () thing. Just take the lines below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let wtcalc1= 0.2*weight; 					
%let wtcalc2= 0.5*weight;					
%let wtcalc3= 0.8*weight;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I need same the lines into a single line, which can run inside a macro and store/attach the line&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to dataset for later backtracking.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running varied tryouts on calculation logic. Too many variations, easy to get lost how to&lt;/P&gt;
&lt;P&gt;get the result datasets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;6749  %let wtcalc1= 0.2*weight;
6750  %let wtcalc2= 0.5*weight;
ERROR: Open code statement recursion detected.
6751  %let wtcalc3= 0.8*weight;
ERROR: Open code statement recursion detected.
6752
6753  %let logicx=%let wtcalc1= 0.2*weight;
ERROR: Open code statement recursion detected.
6754  %let wtcalc2= 0.5*weight;
ERROR: Open code statement recursion detected.
6755  %let wtcalc3= 0.8*weight;
ERROR: Open code statement recursion detected.
6756
6757  %let logicx=\\%let wtcalc1= 0.2*weight;
ERROR: Open code statement recursion detected.
6758  \\%let wtcalc2= 0.5*weight;
ERROR: Open code statement recursion detected.
6759  \\%let wtcalc3= 0.8*weight;
ERROR: Open code statement recursion detected.
6760
6761  %let logicx="%let wtcalc1= 0.2*weight;
ERROR: Open code statement recursion detected.
6762  %let wtcalc2= 0.5*weight;
6763  %let wtcalc3= 0.8*weight;"
6764
6765  %put "logic=&amp;amp;logicx.";
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Oct 2025 23:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977338#M378477</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-10-18T23:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977339#M378478</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks, Tom.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;6784  %let wtcalc1= 0.2*weight;
6785  %let wtcalc2= 0.5*weight;
6786  %let wtcalc3= 0.8*weight;
6787
6788  data _null_;
6789    length logicx $4000 ;
6790    retain logicx;
6791    set sashelp.vmacro end=eof;
6792    where name =: 'WTCALC' and offset=0;
6793    logicx=cats(logicx,catx(' ','%let',name),'=',symget(name),';');
6794    if eof then call symputx('logicx',logicx);
6795  run;

NOTE: There were 3 observations read from the data set SASHELP.VMACRO.
      WHERE (name=:'WTCALC') and (offset=0);
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


6796  %let logicx=%superq(logicx);
6797
6798  %put "logic=&amp;amp;logicx.";
"logic=%let WTCALC1=0.2*weight;%let WTCALC2=0.5*weight;%let WTCALC3=0.8*weight;"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Oct 2025 23:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977339#M378478</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-10-18T23:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to put multiple %let MVar=x lines into one Macro Variable/Line?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977340#M378479</link>
      <description>Thanks, this works out also.</description>
      <pubDate>Sat, 18 Oct 2025 23:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-multiple-let-MVar-x-lines-into-one-Macro-Variable/m-p/977340#M378479</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-10-18T23:36:08Z</dc:date>
    </item>
  </channel>
</rss>

