<?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 update a macro variable in a call execute in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895336#M353737</link>
    <description>DOSUBL instead of CALL EXECUTE which runs immediately.</description>
    <pubDate>Thu, 21 Sep 2023 18:52:08 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-09-21T18:52:08Z</dc:date>
    <item>
      <title>how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895266#M353698</link>
      <description>&lt;P&gt;I want to delete the selected variable dynamically from the macro variable that was set at the beginning.&lt;/P&gt;
&lt;P&gt;I put the code for context, it won't run like this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Imagine I start with the macro variable having the value : var1 var2 var3 var4&lt;/P&gt;
&lt;P&gt;Now I select var2 from the glmselect and I want to withdraw it form the macro variable so that it becomes : var1 var3 var4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data matched;
format _from _to $32. r2 8.3;
output;
run;

data matched;
set matched(obs=0);
run;

proc sql;
select name into :vary separated by ' ' 
from nok where type=1;
quit;

%put &amp;amp;vary.;


data _null_;
set WORK.NAMY_OK(obs=10 where=(type=1 and ^index(lowcase(name), 'var') ));
call execute ('
ods output ModelInfo=model SelectionSummary=selsum;
proc glmselect data=public.ttt ;
model ' || name || '  = &amp;amp;vary. / selection=stepwise( stop=1 ) noint;
run;

proc sql;
select tranwrd("&amp;amp;vary.", strip(EffectEntered),"") into :vary 
from WORK.SELSUM;
quit;


%put &amp;amp;vary.;

proc sql;
insert into matched(_from, _to, r2 )
select ' || quote(name) || ', strip(EffectEntered), RSquare 
from  WORK.SELSUM;
quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 14:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895266#M353698</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T14:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895278#M353704</link>
      <description>&lt;P&gt;You could use TRANWRD to replace the string you want to remove with a blank, for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let list=var1 var2 var3 var4; &lt;BR /&gt;%let cnt=%sysfunc(countw(&amp;amp;list)); &lt;BR /&gt;%macro test(remove); &lt;BR /&gt;%let newlist=%cmpres(%sysfunc(tranwrd(&amp;amp;list,&amp;amp;remove,%str()))); &lt;BR /&gt;%put &amp;amp;newlist; &lt;BR /&gt;%mend test; &lt;/P&gt;
&lt;P&gt;/* Pass in the string you want to remove */&lt;/P&gt;
&lt;P&gt;%test(var2) &lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 14:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895278#M353704</guid>
      <dc:creator>russt_sas</dc:creator>
      <dc:date>2023-09-21T14:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895281#M353707</link>
      <description>&lt;P&gt;Thanks, I get the point, but I cannot adapt it to my needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need the macro variable to be updated, not to create a new one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once a variable get selected I want to hide from being selected again.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895281#M353707</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T15:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895282#M353708</link>
      <description>&lt;P&gt;You do not have to create a new variable, that was just an example.&amp;nbsp; Here is the same code using the same variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let list=var1 var2 var3 var4; &lt;BR /&gt;%let cnt=%sysfunc(countw(&amp;amp;list)); &lt;BR /&gt;%macro test(remove); &lt;BR /&gt;%let list=%cmpres(%sysfunc(tranwrd(&amp;amp;list,&amp;amp;remove,%str()))); &lt;BR /&gt;%put &amp;amp;list; &lt;BR /&gt;%mend test; &lt;BR /&gt;%test(var2) &lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895282#M353708</guid>
      <dc:creator>russt_sas</dc:creator>
      <dc:date>2023-09-21T15:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895284#M353709</link>
      <description>&lt;P&gt;One potential gotcha I always forget is that despite the name, TRANWRD doesn't actually know about word boundaries.&amp;nbsp; So if the word you delete is a substring of another word, it will delete the substring as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    %let vary=AAA AAABBB BBB CCC ;
2    %let vary=%sysfunc(tranwrd(&amp;amp;vary,BBB,)) ;
3    %put &amp;amp;=vary ;
VARY=AAA AAA    CCC
&lt;/PRE&gt;
&lt;P&gt;You can add delimiters to the ends of the list to work around this, perhaps with something ugly like:&lt;/P&gt;
&lt;PRE&gt;1    %let vary=AAA AAABBB BBB CCC ;
2    %let vary=%sysfunc(transtrn(%str( )&amp;amp;vary%str( ),%str( BBB ),%str( ))) ;
3    %put &amp;amp;=vary ;
VARY=AAA AAABBB CCC&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:13:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895284#M353709</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-09-21T15:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895285#M353710</link>
      <description>&lt;P&gt;No, it does not work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data matched;
format _from _to $32. r2 8.3;
output;
run;

data matched;
set matched(obs=0);
run;

proc sql;
select name into :vary separated by ' ' 
from nok where type=1;
quit;

%put &amp;amp;vary.;

%macro test(remove);
%let vary=%cmpres(%sysfunc(tranwrd(&amp;amp;vary,&amp;amp;remove,%str())));
%put &amp;amp;vary;
%mend test;

data _null_;
set WORK.NAMY_OK(obs=10 where=(type=1 and ^index(lowcase(name), 'var') ));
call execute ('
ods output ModelInfo=model SelectionSummary=selsum;
proc glmselect data=public.ttt ;
model ' || name || '  = &amp;amp;vary. / selection=stepwise( stop=1 ) noint;
run;

proc sql;
select strip(EffectEntered) into :oks 
from WORK.SELSUM;
quit;


%test(&amp;amp;oks.);

proc sql;
insert into matched(_from, _to, r2 )
select ' || quote(name) || ', strip(EffectEntered), RSquare 
from  WORK.SELSUM;
quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895285#M353710</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T15:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895288#M353712</link>
      <description>&lt;P&gt;Can you share what the NOK data set looks like?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:24:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895288#M353712</guid>
      <dc:creator>russt_sas</dc:creator>
      <dc:date>2023-09-21T15:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895290#M353713</link>
      <description>&lt;P&gt;What does "doesn't work" mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some tricky timing issues with CALL EXECUTE when you use macro code.&amp;nbsp; You should try adding %NRSTR to mask the macro symbols until after CALL EXECUTE has generated the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data _null_ ;
  call execute(
    '%nrstr('
    || '%let vars=name sex height ;'
    || 'proc print data=sashelp.class ; var &amp;amp;vars ; run ;'
    || '%let vars=%sysfunc(transtrn(%str( )&amp;amp;vars%str( ),%str( height ),%str( ))) ;'
    || 'proc print data=sashelp.class ; var &amp;amp;vars ; run ;'
    || ')' 
  ) ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895290#M353713</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-09-21T15:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895294#M353716</link>
      <description>&lt;P&gt;here comes the code / idea applied on sashelp.cars.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to identify variables that despite come without label can be related to other known variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have this situation quite often, this ugly flat files that sometimes change the variable order or loose the variable names.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;
set sashelp.cars;
id=put(_n_, 4.);
keep id _numeric_;
run;

proc sql;
select name||"=var" || strip(put(monotonic(), 3.)) into :reny separated by ' ' 
from dictionary.columns where libname='WORK' and memname='CARS'
and name ne "id";
quit;

data unknown;
set cars;
rename &amp;amp;reny.;
run;

data unknown;
set unknown;
array numy(10) var1-var10;
var_rand=rand('integer', 1, 10);
if rand('uniform', 0, 1) le 0.05 then do;
numy(var_rand)= numy(var_rand)*0.9;
end;
drop var_rand;
run;

proc contents data=cars out=namy_ok;
run;

proc contents data=unknown out=nok;
run;

data together;
merge cars unknown;
by id;
run;


data matched;
format _from _to $32. r2 8.3;
output;
run;

data matched;
set matched(obs=0);
run;

proc sql;
select name into :vary separated by ' ' 
from nok where type=1;
quit;

%put &amp;amp;vary.;


data _null_;
set WORK.NAMY_OK(obs=10 where=(type=1 and ^index(lowcase(name), 'var') ));
call execute ('
ods output ModelInfo=model SelectionSummary=selsum;
proc glmselect data=together ;
model ' || name || '  = &amp;amp;vary. / selection=stepwise( stop=1 ) noint;
run;

proc sql;
select tranwrd("&amp;amp;vary.", strip(EffectEntered),"") into :vary 
from WORK.SELSUM;
quit;

%put &amp;amp;vary.;

proc sql;
insert into matched(_from, _to, r2 )
select ' || quote(name) || ', strip(EffectEntered), RSquare 
from  WORK.SELSUM;
quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895294#M353716</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T15:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895295#M353717</link>
      <description>&lt;P&gt;after every iteration over proc glmselect I want to purge the selected variable from the list of candidates.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895295#M353717</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T15:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895304#M353724</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;after every iteration over proc glmselect I want to purge the selected variable from the list of candidates.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand how CALL EXECUTE() would be involved in solving such a problem.&lt;/P&gt;
&lt;P&gt;CALL EXECUTE() lets you stack up some code to run after the current step (the one that is running the CALL EXECUTE() statement) has finished running.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 16:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895304#M353724</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-21T16:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895332#M353734</link>
      <description>So what Do you propose instead?&lt;BR /&gt;I need to update and shorten the candidate list of variables by when they end up getting selected by glmselect.</description>
      <pubDate>Thu, 21 Sep 2023 18:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895332#M353734</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T18:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895333#M353735</link>
      <description>&lt;P&gt;I am still not 100% sure what you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are wanting to run multiple glmselect on a different variable each time, what determines which variable we use and/or exclude?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you had variables var1 var2 var3 var4, are you wanting to run the glmselect 4 times removing one of the variables each time?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 18:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895333#M353735</guid>
      <dc:creator>russt_sas</dc:creator>
      <dc:date>2023-09-21T18:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895335#M353736</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;So what Do you propose instead?&lt;BR /&gt;I need to update and shorten the candidate list of variables by when they end up getting selected by glmselect.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you trying to simulate a STEPWISE regression? Are you sure the PROC doesn't already support that?&amp;nbsp; Have you confirmed with a statistician that the approach is sensible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to just loop thru the list and take 9 variables each time?&amp;nbsp; So create a macro with code like this to call your model with the N ways to eliminate one variable from a list of N variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let list=A|B|C;
%do i=1 to %sysfunc(countw(&amp;amp;list,|));
  %let varlist=%sysfunc(tranwrd(|&amp;amp;list|,|%scan(&amp;amp;list,&amp;amp;i,|)|,|));
  %let varlist=%sysfunc(translate(&amp;amp;varlist,%str( ),|));
/*
run your model using the N-1 variables in &amp;amp;VARLIST
*/
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want&amp;nbsp;to start with a list of 10 variables and run some statistical test and then select one variable to remove and repeat until what?&amp;nbsp; There is just one variable left?&amp;nbsp; If then the loop might look more like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let list=A B C;
%do %while(%length(&amp;amp;list));
/*
run your model.
select the variable to eliminate into macro variable DROPVAR
*/
  %let list=%sysfunc(tranwrd(%str( &amp;amp;list ),%str( &amp;amp;dropvar ),%str( )));
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2023 18:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895335#M353736</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-21T18:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895336#M353737</link>
      <description>DOSUBL instead of CALL EXECUTE which runs immediately.</description>
      <pubDate>Thu, 21 Sep 2023 18:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895336#M353737</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-21T18:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895339#M353739</link>
      <description>&lt;P&gt;I’ll give that a try. I don’t need the statistical waterproof, it’s meant as a trick to cluster one by one variables that supposed to measure the same whereas one group of variables is duly labeled and has meaningful names while the others stem from a flat file import where labels weren’t transmitted and variable names are like var1-var50.&lt;/P&gt;
&lt;P&gt;Therefore I use the glmselect modeling each by each the known variables trying to find its sibling forcing a regression with stop criteria 1 and skipping an intercept term.&lt;/P&gt;
&lt;P&gt;I would say it gives a good result but I’m struggling to update the unknown variables list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 19:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895339#M353739</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T19:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895340#M353740</link>
      <description>&lt;P&gt;I’ll try tomorrow and let you know&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 19:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895340#M353740</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-21T19:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to update a macro variable in a call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895396#M353767</link>
      <description>&lt;P&gt;Brilliant, So the final code that works look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to fix what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;cautioned, tranwrd does not care about word bounderies, probably I'll go for regex.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;
set sashelp.cars;
id=put(_n_, 4.);
keep id _numeric_;
run;

proc sql;
select name||"=var" || strip(put(monotonic(), 3.)) into :reny separated by ' ' 
from dictionary.columns where libname='WORK' and memname='CARS'
and name ne "id";
quit;

data unknown;
set cars;
rename &amp;amp;reny.;
run;

data unknown;
set unknown;
array numy(10) var1-var10;
var_rand=rand('integer', 1, 10);
if rand('uniform', 0, 1) le 0.05 then do;
numy(var_rand)= numy(var_rand)*0.9;
end;
drop var_rand;
run;

proc contents data=cars out=namy_ok;
run;

proc contents data=unknown out=nok;
run;

data together;
merge cars unknown;
by id;
run;


data matched;
format _from _to $32. r2 8.3;
output;
run;

data matched;
set matched(obs=0);
run;

proc sql;
select name into :vary separated by ' ' 
from nok where type=1;
quit;

%put &amp;amp;vary.;


data _null_;
set WORK.NAMY_OK(obs=10 where=(type=1 and ^index(lowcase(name), 'var') ));
rc=dosubl ('
ods output ModelInfo=model SelectionSummary=selsum;
proc glmselect data=together ;
model ' || name || '  = &amp;amp;vary. / selection=stepwise( stop=1 ) noint;
run;

proc sql;
select tranwrd("&amp;amp;vary.", strip(EffectEntered),"") into :vary 
from WORK.SELSUM;
quit;

%put &amp;amp;vary.;

proc sql;
insert into matched(_from, _to, r2 )
select ' || quote(name) || ', strip(EffectEntered), RSquare 
from  WORK.SELSUM;
quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Sep 2023 07:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-a-macro-variable-in-a-call-execute/m-p/895396#M353767</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-09-22T07:45:37Z</dc:date>
    </item>
  </channel>
</rss>

