<?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: iterative data reduction macro in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525236#M4916</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6196"&gt;@RobertNYC&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, I removed a bunch of the code. My actual question&amp;nbsp; just is&amp;nbsp; how to a write an iterative macro which stops&amp;nbsp;processing when&amp;nbsp; the variables rep and first are both equal to *&amp;nbsp;.&amp;nbsp; So, do until rep='*' and first='*'&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Macro code doesn't access data variables directly.&amp;nbsp; It looks like you want to keep running until ALL observations have the value '*'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one way to make such a test and populate a macro variable with either YES or NO to represent the result.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let done=YES ;
data _null_;
  set have ;
  if rep ne '*' or first ne '*' then do;
    call symputx('done'='NO');
    stop;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then perhaps include that into a loop in your macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%local done ;
...
%do %until (&amp;amp;done = YES);
...
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you might want to add more logic to make sure that you don't get into an infinite loop.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 21:46:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-01-07T21:46:16Z</dc:date>
    <item>
      <title>iterative data reduction macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525194#M4897</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a long data reduction program which reduces variables to get ready for predictive modeling. &amp;nbsp;The main procedure I use is proc varclus.&amp;nbsp; &amp;nbsp;What I would like to like to do is make this more automated.&amp;nbsp; What I would like to have happen is have the data reduction macro run again and again for one target until the variables &lt;STRONG&gt;rep&lt;/STRONG&gt; and &lt;STRONG&gt;first&lt;/STRONG&gt; are equal to each other.&amp;nbsp; So, in other words run over and over again until only one variable falls into each cluster.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example after one run, I may get a data set which looks like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example after one run, I may get a data set which looks like this.&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;&lt;STRONG&gt;_NAME_&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&lt;STRONG&gt;rep&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&lt;STRONG&gt;first&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;POR_COR_AP_W&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;POR_KIDS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;MPRTL6&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;M_PER&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;FLAG_DRESS_B&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;FIRST_PROD_W&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;FLAG_ACC_G&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;FRAGRANCE_PER&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;NE_ind&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;DSLP&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;PUR_FOOTWEAR_B&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;PUR_Q2&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;MDOLL76&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;avg_LUX_APPAREL_M_PV&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;ROR_KIDS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;TOTALP_STORES&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;PUR_ACC_B&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;MKD_OTHER&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;sales_ratiod&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like the macro to run over and over again until &amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;&lt;STRONG&gt;_NAME_&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&lt;STRONG&gt;rep&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;&lt;STRONG&gt;first&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;MPRTL6&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;NE_ind&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;DSLP&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;PUR_FOOTWEAR_B&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;MDOLL76&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;ROR_KIDS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;TOTALP_STORES&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;MKD_OTHER&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="218"&gt;
&lt;P&gt;sales_ratiod&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84"&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’m having trouble programming in the iterative process&amp;nbsp; any feedback /help id greatly appreciated&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro reduce(n=, t=, b=, outstat=);


proc corr data= mod.master_model_build  best=&amp;amp;b. noprob outp=cor_&amp;amp;t. noprint  nosimple ; 
var /*my vars***/; 



;
with 
&amp;amp;t.; run;

/*******reduction code........*/
/*******reduction code........*/
/*******reduction code........*/
/*******reduction code........*/
/*******reduction code........*/

/******Eventually the code comes to a proc varclus statement*******/

proc varclus data=mod.master_model_build  maxeigen=.9 outstat=&amp;amp;outstat.  noprint short;
var &amp;amp;varlist.;run;


/*******more reduction code........*/
/*******more reduction code........*/

/***last step***/
data t12;
merge t12 t3;
by cluster;
if r2ratio=minrat then rep='*';
else rep='';
if first.cluster then first='*';
drop minrat;
run;

data mod.best_&amp;amp;t.; 
set  t12;
keep _name_ rep first;
/***I always want to take the var that is at the top of the cluster***/
where  first='*' ;run; 

;run; 

&lt;STRONG&gt;/***and here is where it ends****/&lt;/STRONG&gt;
&lt;STRONG&gt;/****I have to run again if first='*' is not equal to rep='*'***/&lt;/STRONG&gt;
%mend;
%reduce(outstat=statset1,  t=depvar1,  b=9999);run; 
%reduce(outstat=statset2,  t=depvar2,  b=9999);run; 
%reduce(outstat=statset3,  t=depvar3,  b=9999);run; 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Jan 2019 19:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525194#M4897</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2019-01-07T19:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: iterative data reduction macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525199#M4898</link>
      <description>&lt;P&gt;Forgive me but I'm not going to try to give a direct answer to your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I point out that if you really want to do predictive modelling, why would you use a method like variable clustering, that doesn't take into account the ability of the X variables to predict the Y? How could you possibly get the best predictive model that way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wouldn't it make more sense to use a method that determines which variables are most predictive and then uses those variables in the predictive model? If so, if you think that makes more sense, then forget this variable reduction via variable clustering idea, and use Partial Least Squares (PROC PLS in SAS). PLS gives high weights to variables that are predictive and low weights to variables that are not predictive, and this not only overcomes the drawbacks of variable clustering, but also means you don't have to write and debug a macro to do this. And as a side benefit, all of this effort of "selecting the right variables for the predictive model" goes away as well.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 19:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525199#M4898</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-07T19:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: iterative data reduction macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525204#M4900</link>
      <description>the question above about isn't about predictive molding its about modifying a macro to make it iterative.</description>
      <pubDate>Mon, 07 Jan 2019 20:00:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525204#M4900</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2019-01-07T20:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: iterative data reduction macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525209#M4901</link>
      <description>&lt;P&gt;I cannot tell what you need help with.&lt;/P&gt;
&lt;P&gt;Your posted code doesn't really look like a full program. Is that because you removed some of the details to make the code smaller?&lt;/P&gt;
&lt;P&gt;What is you actual question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want your macro to loop you probably want to add a %DO loop.&amp;nbsp; What kind depends on what you actually want to change on each iteration of the loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 20:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525209#M4901</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-07T20:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: iterative data reduction macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525233#M4914</link>
      <description>&lt;P&gt;Yes, I removed a bunch of the code. My actual question&amp;nbsp; just is&amp;nbsp; how to a write an iterative macro which stops&amp;nbsp;processing when&amp;nbsp; the variables rep and first are both equal to *&amp;nbsp;.&amp;nbsp; So, do until rep='*' and first='*'&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 21:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525233#M4914</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2019-01-07T21:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: iterative data reduction macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525236#M4916</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6196"&gt;@RobertNYC&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, I removed a bunch of the code. My actual question&amp;nbsp; just is&amp;nbsp; how to a write an iterative macro which stops&amp;nbsp;processing when&amp;nbsp; the variables rep and first are both equal to *&amp;nbsp;.&amp;nbsp; So, do until rep='*' and first='*'&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Macro code doesn't access data variables directly.&amp;nbsp; It looks like you want to keep running until ALL observations have the value '*'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one way to make such a test and populate a macro variable with either YES or NO to represent the result.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let done=YES ;
data _null_;
  set have ;
  if rep ne '*' or first ne '*' then do;
    call symputx('done'='NO');
    stop;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then perhaps include that into a loop in your macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%local done ;
...
%do %until (&amp;amp;done = YES);
...
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you might want to add more logic to make sure that you don't get into an infinite loop.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 21:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525236#M4916</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-07T21:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: iterative data reduction macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525242#M4919</link>
      <description>&lt;P&gt;Thanks Tom, this is very helpful.&amp;nbsp; I will see if I can figure it out.&amp;nbsp; thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 21:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/iterative-data-reduction-macro/m-p/525242#M4919</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2019-01-07T21:49:02Z</dc:date>
    </item>
  </channel>
</rss>

