<?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 run a macro to the end of file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330691#M74240</link>
    <description>&lt;P&gt;If you're asking this question to resolve the revision to your request&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Merging-data-based-on-variable-names-from-1-data-file-and/td-p/330374" target="_self"&gt;Merging data based on (variable names from 1 data file) and (variables value from another data file&lt;/A&gt;,&amp;nbsp;then making the macro loop you contemplate&amp;nbsp;is not an efficient solution.&amp;nbsp; Instead use a PUT statement in the first DATA step to write out neccessary code, and then %include that code in a second data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data condition; 
input condition_ID cond1 :$1. value1 cond2 :$1. value2;
datalines;
1 a 4 b 5
2 c 1 d 2
;run;
data FULLDATA; 
input date a b c d ;
datalines;
11 4 5 1 1
12 4 5 2 5
13 4 1 2 6
14 8 3 1 2
;run;

filename tmp temp;
data _null_;
  set condition end=last_cond;
  file tmp;
  put 'if ' cond1 '=' value1 'and ' cond2 '=' value2  
      ' then condition_id=' condition_id ';' @;
  if last_cond=0  then put 'else';
run;

options source2;
data want;
  set fulldata;
  %include tmp;
  if condition_id &amp;gt;=1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2017 02:16:47 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2017-02-08T02:16:47Z</dc:date>
    <item>
      <title>How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330688#M74237</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to run the below macro to create individual file for each record.&lt;/P&gt;
&lt;P&gt;However, I dont know how to tell SAS to run "to the end of file".&lt;/P&gt;
&lt;P&gt;Could anyone help me out?&lt;/P&gt;
&lt;P&gt;So many thanks,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input time start;
datalines;
1 1
2 1
3 .
4 -1
5 .
6 1
7 -1
8 .
9 .
10 9
11 2
12 6
1 1
2 1
3 .
4 -1
5 .
6 1
7 -133
8 .
9 .
10 933
11 233
12 633
1 1
2 1
3 .
4 -1
5 .
6 1
7 -1
8 .
9 .
10 9
11 2
12 6
1 1
2 1
3 .
4 -1
5 .
6 1
7 -133
8 .
9 .
10 933
11 233
12 633
;
run;

%macro split;

	/*add this 4 line of code and it will create the &amp;amp;nobs; 
		dont need to make any adjustment on nobs 
		this below run exactly 4 rounds*/

%local dsid nobs rc;
%let dsid = %sysfunc(open(condition));
%let nobs = %sysfunc(attrn(&amp;amp;dsid, nlobs));
%let rc = %sysfunc(close(&amp;amp;dsid));


	%do i=1 %to &amp;amp;nobs;
		data temp; set have;
		if (&amp;amp;i-1)*10&amp;lt;_N_&amp;lt;&amp;amp;i*10;
		
		start2=start*2;
		run;

		%if &amp;amp;i=1 %then %do;
			data final; set temp;run;
			%end;
		%else %do;
			data final; set final temp; run;
			%end;
	%end;
%mend;

%split;
&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;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro cond;&lt;BR /&gt; %do i=1 %to 4; *HOW TO MAKE IT: i=1 to END OF FILE ;&lt;BR /&gt; data single_condition_&amp;amp;i; set condition;&lt;BR /&gt; if _N_=&amp;amp;i;&lt;BR /&gt; run;&lt;BR /&gt;&lt;BR /&gt; MACRO CODE BODY&lt;BR /&gt; MACRO CODE BODY&lt;BR /&gt;&lt;BR /&gt; %end;&lt;BR /&gt;%mend;&lt;BR /&gt; %cond;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 03:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330688#M74237</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-22T03:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330689#M74238</link>
      <description>&lt;P&gt;Here's a simple way of making it work, using the numeric attribute&amp;nbsp;&lt;EM&gt;nlobs&lt;/EM&gt; (number of logical observations (to ignore deleted observations - usually a good idea)) from the dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option mprint notes;

data condition; 
input condition_ID cond1 $ value1 ;
datalines;
1 a 4 
2 c 1
3 a 1
4 f 40
;
run;

%macro cond;
%local dsid nobs rc;
%let dsid = %sysfunc(open(condition));
%let nobs = %sysfunc(attrn(&amp;amp;dsid, nlobs));
%let rc = %sysfunc(close(&amp;amp;dsid));
	%do i=1 %to &amp;amp;nobs;	
		data single_condition_&amp;amp;i; 
		set condition(firstobs=&amp;amp;i obs=&amp;amp;i);
		run;
	%end;
%mend cond;
%cond;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that I've used&amp;nbsp;&lt;EM&gt;firstobs&lt;/EM&gt; and&amp;nbsp;&lt;EM&gt;obs&lt;/EM&gt; instead of&amp;nbsp;&lt;EM&gt;_n_&lt;/EM&gt; - if &lt;EM&gt;condition&lt;/EM&gt; is large, this will be more efficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm interested - what's the problem you're trying to solve?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 02:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330689#M74238</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-02-08T02:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330691#M74240</link>
      <description>&lt;P&gt;If you're asking this question to resolve the revision to your request&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Merging-data-based-on-variable-names-from-1-data-file-and/td-p/330374" target="_self"&gt;Merging data based on (variable names from 1 data file) and (variables value from another data file&lt;/A&gt;,&amp;nbsp;then making the macro loop you contemplate&amp;nbsp;is not an efficient solution.&amp;nbsp; Instead use a PUT statement in the first DATA step to write out neccessary code, and then %include that code in a second data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data condition; 
input condition_ID cond1 :$1. value1 cond2 :$1. value2;
datalines;
1 a 4 b 5
2 c 1 d 2
;run;
data FULLDATA; 
input date a b c d ;
datalines;
11 4 5 1 1
12 4 5 2 5
13 4 1 2 6
14 8 3 1 2
;run;

filename tmp temp;
data _null_;
  set condition end=last_cond;
  file tmp;
  put 'if ' cond1 '=' value1 'and ' cond2 '=' value2  
      ' then condition_id=' condition_id ';' @;
  if last_cond=0  then put 'else';
run;

options source2;
data want;
  set fulldata;
  %include tmp;
  if condition_id &amp;gt;=1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 02:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330691#M74240</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-08T02:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330695#M74243</link>
      <description>&lt;P&gt;Both of your codes work fine.&lt;/P&gt;
&lt;P&gt;However, for the sake of knowledge, could you tell me how to put this End_of_File number into my Macro.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 02:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330695#M74243</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-08T02:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330697#M74245</link>
      <description>&lt;P&gt;Well, you don't need to - my code picks the number of observations up from the metadata for the dataset. It interrogates the number of observations and&amp;nbsp;&lt;EM&gt;always&lt;/EM&gt; gets it right (as long as the dataset is a SAS one), saving you the bother of putting it in as a parameter.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 02:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330697#M74245</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-02-08T02:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330706#M74252</link>
      <description>&lt;P&gt;You may use the "nobs=" parameter of the set statement, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt; tmp temp&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; _null_&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; condition end&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;last_cond&amp;nbsp; nobs=nconds;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token statement"&gt;file&lt;/SPAN&gt; tmp&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'if '&lt;/SPAN&gt; cond1 &lt;SPAN class="token string"&gt;'='&lt;/SPAN&gt; value1 &lt;SPAN class="token string"&gt;'and '&lt;/SPAN&gt; cond2 &lt;SPAN class="token string"&gt;'='&lt;/SPAN&gt; value2&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token string"&gt;' then condition_id='&lt;/SPAN&gt; condition_id &lt;SPAN class="token string"&gt;' out of '&amp;nbsp;nconds ';'&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;@&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; last_cond&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'else'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; else putlog "there are a total of " nconds " conditions." ;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;%put &amp;amp;=cond;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 03:53:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330706#M74252</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-08T03:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330766#M74272</link>
      <description>&lt;P&gt;You could of course save yourself the i/o and temp file management by using call execute:&lt;/P&gt;
&lt;PRE&gt;data condition; 
  input condition_ID cond1 :$1. value1 cond2 :$1. value2;
datalines;
1 a 4 b 5
2 c 1 d 2
;
run;
data fulldata; 
  input date a b c d ;
datalines;
11 4 5 1 1
12 4 5 2 5
13 4 1 2 6
14 8 3 1 2
;
run;

data _null_;
  set condition end=last;
  if _n_=1 then call execute('data want; set fulldata;');
  call execute('if ',strip(cond1),'=',strip(value1),' and ',strip(cond2),'=',strip(value2),' then condition_id=',strip(condition_id),';');
  if last then call execute(' if condition_id &amp;gt;= 1 then output; run;');
run;&lt;/PRE&gt;
&lt;P&gt;However the above is a total faff caused by bad structure of the data - i.e. using transposed data. &amp;nbsp;If you normalise the data then you don't need code generation at all, its is just a merge:&lt;/P&gt;
&lt;PRE&gt;/* This is the problem dataset, modify this */
data condition; 
  input condition_ID cond1 :$1. value1 cond2 :$1. value2;
datalines;
1 a 4 b 5
2 c 1 d 2
;
run;

data condition (keep=chk:);
  set condition end=last;
  retain chk_a chk_b chk_c chk_d;
  if cond1="a" then chk_a=value1;
  if cond1="c" then chk_b=value1;
  if cond2="b" then chk_c=value2;
  if cond2="d" then chk_d=value2;
  if last then output;
run;

data fulldata; 
  input date a b c d ;
datalines;
11 4 5 1 1
12 4 5 2 5
13 4 1 2 6
14 8 3 1 2
;
run;

proc sql;
  create table WANT as
  select  A.*
  from    FULLDATA A
  left join CONDITION B
  on      1=1
  where   (A=CHK_A and B=CHK_B) 
    or    (C=CHK_C and D=CHK_D);
quit; &lt;/PRE&gt;
&lt;P&gt;Structure of data is pivotal in how complex/messy code is.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 10:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330766#M74272</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-08T10:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330891#M74307</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems fine but I dont know why SAS gives error notice &amp;nbsp;"The EXECUTE subroutine call has too many arguments."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 16:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330891#M74307</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-08T16:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330901#M74310</link>
      <description>&lt;P&gt;Yes, sorry, too used to using cat() functions. &amp;nbsp;This:&lt;/P&gt;
&lt;PRE&gt;  call execute('if ',strip(cond1),'=',strip(value1),' and ',strip(cond2),'=',strip(value2),' then condition_id=',strip(condition_id),';');
&lt;/PRE&gt;
&lt;P&gt;Should read:&lt;/P&gt;
&lt;PRE&gt;  call execute('if '||strip(cond1)||'='||strip(value1)||' and '||strip(cond2)||'='||strip(value2)||' then condition_id='||strip(condition_id)||';');
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 16:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/330901#M74310</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-08T16:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/331057#M74361</link>
      <description>&lt;P&gt;The code works now.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since for each condition, I want to get all records meet it, the final file will have some duplicate due to the fact that 1 record satistfy multiple conditions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I modify your code a bit and get it done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I wonder is the role of "if condition_id&amp;gt;=1".&lt;/P&gt;
&lt;P&gt;In the log file, the SAS understand the code as:&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 want2; set fulldata;
if a=4 and b=5 then do; condition_id=1;output;end;
if c=1 and d=2 then do; condition_id=2;output;end;
if c=9 and d=9 then do; condition_id=3;output;end;
if condition_id &amp;gt;= 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this case having or not having the&amp;nbsp;"if condition_id&amp;gt;=1" doesn't make any difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what is the role of that&amp;nbsp;&lt;SPAN&gt;"if condition_id&amp;gt;=1" in your code and mkeintz code.&amp;nbsp;Clearly, I miss an important point here.&lt;/SPAN&gt;&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;if last then call execute(' if condition_id &amp;gt;= 1 ; run;');&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;By the way, the code I finally got is below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks alot,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;HHC&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set condition end=last;
  if _n_=1 then call execute('data want2; set fulldata;');
  call execute('if '||strip(cond1)||'='||strip(value1)||' and '||strip(cond2)||'='||strip(value2)||' then do; condition_id='||strip(condition_id)|| ';output;end;');

if last then call execute(' if condition_id &amp;gt;= 1 ; run;');
run;



data _null_;
  set condition end=last;
  if _n_=1 then call execute('data want2; set fulldata;');
  call execute('if '||strip(cond1)||'='||strip(value1)||' and '||strip(cond2)||'='||strip(value2)||' then do; condition_id='||strip(condition_id)|| ';output;end;');

if last then call execute(' ; run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 02:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/331057#M74361</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-09T02:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/331059#M74362</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The code works now.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since for each condition, I want to get all records meet it, the final file will have some duplicate due to the fact that 1 record satistfy multiple conditions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I modify your code a bit and get it done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I wonder is the role of "if condition_id&amp;gt;=1".&lt;/P&gt;
&lt;P&gt;In the log file, the SAS understand the code as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I believe&amp;nbsp;I told you to remove the "if condition_id&amp;gt;1" statement once the explicit OUTPUT statements were introduced in the other topic you started that is confounded with this one.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 03:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/331059#M74362</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-09T03:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a macro to the end of file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/331063#M74363</link>
      <description>&lt;P&gt;Yes you did.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 04:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-macro-to-the-end-of-file/m-p/331063#M74363</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-02-09T04:09:31Z</dc:date>
    </item>
  </channel>
</rss>

