<?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 Skip Macro iteration based on a file of no_run condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436311#M108517</link>
    <description>&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;Hi Everyone,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; box-sizing: inherit; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;I try to optimize my Macro program and here is my situation.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; box-sizing: inherit; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;I have 2 DO-LOOP (DO a, DO h).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;And I have a file contains all no checking condition (no_run file). &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;So at the beginning of the inner loop (DO h), I want to check if that “h” belong to the No-Checking condition or not. If belong, move to next iteration.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;In the example, I dont want to run the main code for Height = 56 57 58 60.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;(Clearly, for the simple problem below, I can simply delete the condition from the list of h)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
*Create a No_run file to save value;
data no_run;
input height_no_run_value;
datalines;
56
57
58
60
;run;


%Macro skip;
	%let age_list	 = 12 13 ;
	%let Height_list = 50 51 53 55 56 57 58 60;

	%do a=1 	%to %sysfunc(countw(&amp;amp;age_list));
	%do H=1 	%to %sysfunc(countw(&amp;amp;Height_list));

		%put &amp;amp;h;


		/*Check the no-run value*/
			%if %scan(&amp;amp;height_list, &amp;amp;h) belong to no_run file %then %GOTO EXIT_STEP;


		/*MAIN CODE*/
		data Age&amp;amp;a._Height&amp;amp;H ; set have;
		if age=%scan(&amp;amp;age_list, &amp;amp;a) and height&amp;lt;%scan(&amp;amp;height_list, &amp;amp;h);run;

	%end;
	%EXIT_STEP:
	%end;
%Mend;

%SKIP;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;KEY&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have; set sashelp.class; run;

*Create a No_run file to save value;
data no_run;
input height_no_run_value;
datalines;
56
57
58
60
;run;

proc sql;
select distinct height_no_run_value into : skip_list separated by ' ' from no_run;
quit;

%put &amp;amp;skip_list;run;


%Macro skip;
	%let age_list	 = 12 13 ;
	%let Height_list = 50 51 53 55 			56 57 58 59 60;

	%do a=1 	%to %sysfunc(countw(&amp;amp;age_list));
	%do H=1 	%to %sysfunc(countw(&amp;amp;Height_list));

		%put %scan(&amp;amp;height_list, &amp;amp;h);


		/*Check the no-run value*/

			%let current_height = %scan(&amp;amp;height_list, &amp;amp;h);

			%if %index(&amp;amp;skip_list, &amp;amp;current_height) = 0 %then %do;


		/*MAIN CODE*/
		data Age%scan(&amp;amp;age_list, &amp;amp;a)_Height%scan(&amp;amp;height_list, &amp;amp;h) ; set have;
		if age=%scan(&amp;amp;age_list, &amp;amp;a) and height&amp;lt;%scan(&amp;amp;height_list, &amp;amp;h);run;

		%end;

	%end;
	%EXIT_STEP:
	%end;
%Mend;

%SKIP;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 29 Mar 2019 20:49:44 GMT</pubDate>
    <dc:creator>hhchenfx</dc:creator>
    <dc:date>2019-03-29T20:49:44Z</dc:date>
    <item>
      <title>Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436311#M108517</link>
      <description>&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;Hi Everyone,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; box-sizing: inherit; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;I try to optimize my Macro program and here is my situation.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt; box-sizing: inherit; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;I have 2 DO-LOOP (DO a, DO h).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;And I have a file contains all no checking condition (no_run file). &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;So at the beginning of the inner loop (DO h), I want to check if that “h” belong to the No-Checking condition or not. If belong, move to next iteration.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;In the example, I dont want to run the main code for Height = 56 57 58 60.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica',sans-serif; color: #333333;"&gt;(Clearly, for the simple problem below, I can simply delete the condition from the list of h)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; margin-bottom: .0001pt; line-height: 15.75pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
*Create a No_run file to save value;
data no_run;
input height_no_run_value;
datalines;
56
57
58
60
;run;


%Macro skip;
	%let age_list	 = 12 13 ;
	%let Height_list = 50 51 53 55 56 57 58 60;

	%do a=1 	%to %sysfunc(countw(&amp;amp;age_list));
	%do H=1 	%to %sysfunc(countw(&amp;amp;Height_list));

		%put &amp;amp;h;


		/*Check the no-run value*/
			%if %scan(&amp;amp;height_list, &amp;amp;h) belong to no_run file %then %GOTO EXIT_STEP;


		/*MAIN CODE*/
		data Age&amp;amp;a._Height&amp;amp;H ; set have;
		if age=%scan(&amp;amp;age_list, &amp;amp;a) and height&amp;lt;%scan(&amp;amp;height_list, &amp;amp;h);run;

	%end;
	%EXIT_STEP:
	%end;
%Mend;

%SKIP;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;KEY&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have; set sashelp.class; run;

*Create a No_run file to save value;
data no_run;
input height_no_run_value;
datalines;
56
57
58
60
;run;

proc sql;
select distinct height_no_run_value into : skip_list separated by ' ' from no_run;
quit;

%put &amp;amp;skip_list;run;


%Macro skip;
	%let age_list	 = 12 13 ;
	%let Height_list = 50 51 53 55 			56 57 58 59 60;

	%do a=1 	%to %sysfunc(countw(&amp;amp;age_list));
	%do H=1 	%to %sysfunc(countw(&amp;amp;Height_list));

		%put %scan(&amp;amp;height_list, &amp;amp;h);


		/*Check the no-run value*/

			%let current_height = %scan(&amp;amp;height_list, &amp;amp;h);

			%if %index(&amp;amp;skip_list, &amp;amp;current_height) = 0 %then %do;


		/*MAIN CODE*/
		data Age%scan(&amp;amp;age_list, &amp;amp;a)_Height%scan(&amp;amp;height_list, &amp;amp;h) ; set have;
		if age=%scan(&amp;amp;age_list, &amp;amp;a) and height&amp;lt;%scan(&amp;amp;height_list, &amp;amp;h);run;

		%end;

	%end;
	%EXIT_STEP:
	%end;
%Mend;

%SKIP;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Mar 2019 20:49:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436311#M108517</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-03-29T20:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436433#M108520</link>
      <description>&lt;P&gt;First, before calling the macro convert the list of values to skip to a single macro variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;select distinct height_no_run_value into : skip_list separated by ' ' from no_run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then modify the macro definition to compare a single height value to the list of values in &amp;amp;SKIP_LIST.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a general principle (and for this particular case as well), it would be a good idea to eliminate GOTOs.&amp;nbsp; That's easy enough to do here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token macrobound"&gt;%Macro&lt;/SPAN&gt; skip&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; &lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; age_list &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;12&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;13&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; &lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; Height_list &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;50&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;51&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;53&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;55&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;56&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;57&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;58&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;60&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; &lt;SPAN class="token macrostatement"&gt;%do&lt;/SPAN&gt; a&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token macrostatement"&gt;%to&lt;/SPAN&gt; &lt;SPAN class="token macrostatement"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;countw&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;age_list&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; &lt;SPAN class="token macrostatement"&gt;%do&lt;/SPAN&gt; H&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token macrostatement"&gt;%to&lt;/SPAN&gt; &lt;SPAN class="token macrostatement"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;countw&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;Height_list&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; &lt;SPAN class="token macrostatement"&gt;%put&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;h&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN class="token comment"&gt;/*Check the no-run value*/&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; %if %index(&amp;amp;skip_list,&amp;nbsp;%scan(&amp;amp;height_list, &amp;amp;h)) = 0 %then %do;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token comment"&gt;/*MAIN CODE*/&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; Age&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;_Height&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;H &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; age&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token macroname"&gt;%scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;age_list&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; and height&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token macroname"&gt;%scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;height_list&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;h&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token macrostatement"&gt;%end&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; &lt;SPAN class="token macrostatement"&gt;%end&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token punctuation"&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token macrobound"&gt;%Mend&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token punctuation"&gt;The %INDEX functions returns 0 when the second string does not appear within the first string.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token punctuation"&gt;If you had extreme values within &amp;amp;HEIGHT_LIST, additional care would have to be taken.&amp;nbsp; For example, "5" does actually appear within "57" and the %INDEX function would not return 0 under those conditions.&amp;nbsp; However, it seems likely that all your heights will be two digits long, and this complication will not be an issue.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 19:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436433#M108520</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-12T19:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436561#M108579</link>
      <description>&lt;P&gt;Thanks a lot.&lt;/P&gt;
&lt;P&gt;Turn into a string and index it is very interesting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my actual works, I do have the "extreme" value since the list run from 0-100.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you suggest me that additional treatment?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 03:48:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436561#M108579</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-02-13T03:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436603#M108600</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Macro skip;
	%let age_list	 = 12 13 ;
	%let Height_list = 50 51 53 55 56 57 58 60;

	%do a=1 	%to %sysfunc(countw(&amp;amp;age_list));
	%do H=1 	%to %sysfunc(countw(&amp;amp;Height_list));

		%put &amp;amp;h;


		/*Check the no-run value*/
		%let x=;
		data _null_;
		x=findw(&amp;amp;skip_list,%scan(&amp;amp;height_list, &amp;amp;h));
		call symput('x',x);
		run;
		%if &amp;amp;x. = 0 %then %do;

			/*MAIN CODE*/
			data Age&amp;amp;a._Height&amp;amp;H ; set have;
			if age=%scan(&amp;amp;age_list, &amp;amp;a) and height&amp;lt;%scan(&amp;amp;height_list, &amp;amp;h);run;
		%end;

	%end;
	%end;
%Mend;

%SKIP;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;A few modifications to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;code.&lt;BR /&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 08:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436603#M108600</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-02-13T08:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436657#M108627</link>
      <description>&lt;P&gt;With extreme values, one way is to pad both %INDEX strings with blanks.&amp;nbsp; Before vs. after:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%if %index(&amp;amp;skip_list,&amp;nbsp;%scan(&amp;amp;height_list, &amp;amp;h)) = 0 %then %do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%if %index(%str( &amp;amp;skip_list ), %str( %scan(&amp;amp;height_list, &amp;amp;h) )) = 0 %then %do;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 11:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436657#M108627</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-13T11:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436729#M108655</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In your code, the error show up&lt;/P&gt;
&lt;P&gt;ERROR: Macro function %SCAN has too few arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Satish_Parida, the error notice is:&lt;/P&gt;
&lt;P&gt;388: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN&lt;BR /&gt; where the error has occurred.&lt;BR /&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN&lt;BR /&gt; where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even when I separate it, still that error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		%let x=1;
		%let h=2;
		data _null_;
		height_list="1 2 3 4 5 6 7";
		skip_list="6 5 8";

		x=findw(&amp;amp;skip_list,%scan(height_list, &amp;amp;h));
		call symput('x',x);
		run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Feb 2018 14:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436729#M108655</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-02-13T14:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436732#M108657</link>
      <description>&lt;P&gt;OK, let's split it out as two statements, then.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;%if %index(%str( &amp;amp;skip_list ), %str( %scan(&amp;amp;height_list, &amp;amp;h) )) = 0 %then %do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The replacement (be sure to keep all those blanks inside the %INDEX function):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;%let one_age = %scan(&amp;amp;height_list, &amp;amp;h);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;%if %index(%str( &amp;amp;skip_list ), %str( &amp;amp;one_age )) = 0 %then %do;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436732#M108657</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-13T15:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436739#M108660</link>
      <description>&lt;P&gt;Oh, it works perfectly now.&lt;/P&gt;
&lt;P&gt;By the way, why %GOTO is not prefered in Macro. I see it quite easy to control the flow of code.&lt;/P&gt;
&lt;P&gt;Thank you so much.&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436739#M108660</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-02-13T15:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436744#M108661</link>
      <description>&lt;P&gt;Most programmers frown upon use of GOTO unless absolutely necessary.&amp;nbsp; As a general rule (and you could certainly argue that this particular case does not conform to the general rule), GOTO makes it difficult to follow the progression of the program as it moves through various processing steps.&amp;nbsp; It's easier to follow a program that moves from top to bottom, without the possibility of having to return to a prior step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That being said, programming style is up to you.&amp;nbsp; It's really a question of what you find easy to read.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436744#M108661</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-13T15:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Skip Macro iteration based on a file of no_run condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436752#M108663</link>
      <description>&lt;P&gt;Thanks for the tips.&lt;/P&gt;
&lt;P&gt;I think if the code is team-based, GOTO will drive people crazy, but it is ok if you are the only one who write and run code.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Skip-Macro-iteration-based-on-a-file-of-no-run-condition/m-p/436752#M108663</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-02-13T15:31:25Z</dc:date>
    </item>
  </channel>
</rss>

