<?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 do I replace numbers with do loop macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360034#M84694</link>
    <description>&lt;P&gt;Is this your last code ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro yrmo(N) 
   %do I= 233  %To &amp;amp;N; 
         DATA see.a233&amp;amp;Tid_num.; 
           SET abb.abb_233; 
                  WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
          RUN;
    %end; 
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The only macro variable you have supplied is N.&lt;/P&gt;
&lt;P&gt;You defined macro variable I (in the %DO loop) but never used.&lt;/P&gt;
&lt;P&gt;You are using macro variables: &amp;amp;nac and &amp;amp;mac - but you did not show assigning values to them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sappose you meant to do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nac = ...;  /* any given value */
%let mac = ...; /* any given value */
%macro yrmo(N) 
   %do I= 233  %To &amp;amp;N; 
         DATA see.a&amp;amp;i.&amp;amp;Tid_num.; 
           SET abb.abb_&amp;amp;i; 
                  WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
          RUN;
    %end; 
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Did you mean replace names of input and its output datasets, then this might work and run on:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; adb.adb_233, adb.adb_234, adb.adb_235, ... adb.adb_459.&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2017 16:09:34 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2017-05-19T16:09:34Z</dc:date>
    <item>
      <title>how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359765#M84611</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA  see.a233&amp;amp;Tid_num.;
	SET abb.abb_233;
	WHERE 	v1 = "&amp;amp;n"
	OR 		v2 = "&amp;amp;m";

	
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I need to copy and paste a series of above code, from 233 to 459. I think it would be better to use a do loop instead of copying and pasting with so many similar lines. ANy one gives an advice?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that will be&lt;/P&gt;
&lt;P&gt;%macro yrmo(N)&lt;/P&gt;
&lt;P&gt;%do I= 233 %To &amp;amp;N;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend yrmo;&lt;/P&gt;
&lt;P&gt;%yrmo(459);&lt;/P&gt;
&lt;P&gt;right?&lt;/P&gt;
&lt;P&gt;Since each has lots of obs, it will be better to get advince from you first. Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 19:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359765#M84611</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2017-05-18T19:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359773#M84614</link>
      <description>Something like that yes.&lt;BR /&gt;But test it with fewer loops, and with data sets with just few observations.</description>
      <pubDate>Thu, 18 May 2017 19:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359773#M84614</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-05-18T19:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359791#M84619</link>
      <description>&lt;P&gt;Where are the codes stored now?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide a sample?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do any contain embedded blanks?&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 19:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359791#M84619</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-18T19:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359797#M84623</link>
      <description>&lt;P&gt;I do not quite understand. I do not specificaly save it elsewhere. No embeded blanks. below is a kind of sample code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro yrmo(N) 


%do I= 233%To &amp;amp;N; 

DATA see.a233&amp;amp;Tid_num.; 
SET abb.abb_233; 
WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
RUN;
 %end; 
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 20:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359797#M84623</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2017-05-18T20:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359802#M84625</link>
      <description>&lt;P&gt;You have an awful lot of macro variables and called macro that are not defined anywhere.&lt;/P&gt;
&lt;P&gt;And you are not using the &amp;amp;I from the macro loop anywhere so at this point all your a doing is calling the same data step over and over again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you show us a NON-macro version of the code that does what you want for one example? And then point to what should change inside a %do loop?&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 20:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359802#M84625</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-18T20:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359887#M84657</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/40773"&gt;@Bal23&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;I do not quite understand. I do not specificaly save it elsewhere. No embeded blanks. below is a kind of sample code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro yrmo(N) 


%do I= 233%To &amp;amp;N; 

DATA see.a233&amp;amp;Tid_num.; 
SET abb.abb_233; 
WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
RUN;
 %end; 
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I think you just need to replace the number 233 with your macro loop variable:&lt;/P&gt;&lt;PRE&gt;%macro yrmo(N) 
%local i;
%do I=233 %To &amp;amp;N; 
  DATA see.a&amp;amp;i.&amp;amp;Tid_num.; 
    SET abb.abb_&amp;amp;i.; 
    WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
  RUN;
  %end; 
%mend yrmo; 
%yrmo(459); &lt;/PRE&gt;&lt;P&gt;The period after &amp;amp;i is to tell SAS where the name of the macro variable ends, it is needed when there is no space or other delimiter after the reference to the macro variable.&lt;/P&gt;&lt;P&gt;Notice that I also declared the I variable %local to the macro, may save you some debugging time later. And finally, you needed a space before %to in your macro code, which I added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Søren&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 06:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/359887#M84657</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-19T06:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360034#M84694</link>
      <description>&lt;P&gt;Is this your last code ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro yrmo(N) 
   %do I= 233  %To &amp;amp;N; 
         DATA see.a233&amp;amp;Tid_num.; 
           SET abb.abb_233; 
                  WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
          RUN;
    %end; 
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The only macro variable you have supplied is N.&lt;/P&gt;
&lt;P&gt;You defined macro variable I (in the %DO loop) but never used.&lt;/P&gt;
&lt;P&gt;You are using macro variables: &amp;amp;nac and &amp;amp;mac - but you did not show assigning values to them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sappose you meant to do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nac = ...;  /* any given value */
%let mac = ...; /* any given value */
%macro yrmo(N) 
   %do I= 233  %To &amp;amp;N; 
         DATA see.a&amp;amp;i.&amp;amp;Tid_num.; 
           SET abb.abb_&amp;amp;i; 
                  WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
          RUN;
    %end; 
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Did you mean replace names of input and its output datasets, then this might work and run on:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; adb.adb_233, adb.adb_234, adb.adb_235, ... adb.adb_459.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 16:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360034#M84694</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-05-19T16:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360420#M84859</link>
      <description>&lt;P&gt;Thank you. We are almost there, and then I realized that was my mistake.&lt;/P&gt;
&lt;P&gt;from 233 to 459, the list does not include all these numbers.&lt;/P&gt;
&lt;P&gt;see, it is 233, 234,235,236,237,238;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then, it is 333, 334, 335, 336;&lt;/P&gt;
&lt;P&gt;and then, it is 450, 4511,452,453,...459;&lt;/P&gt;
&lt;P&gt;should I include three loops instead of one? Sorry I had not made it clear enough for my original post.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 13:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360420#M84859</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2017-05-22T13:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360494#M84882</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/40773"&gt;@Bal23&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you. We are almost there, and then I realized that was my mistake.&lt;/P&gt;
&lt;P&gt;from 233 to 459, the list does not include all these numbers.&lt;/P&gt;
&lt;P&gt;see, it is 233, 234,235,236,237,238;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then, it is 333, 334, 335, 336;&lt;/P&gt;
&lt;P&gt;and then, it is 450, 4511,452,453,...459;&lt;/P&gt;
&lt;P&gt;should I include three loops instead of one? Sorry I had not made it clear enough for my original post.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;An irregular set of values such as you show may work better by creating a control data set that has the values you need as one record per value and then use a data null step with call execute.&lt;/P&gt;
&lt;P&gt;Your other undefined macros may cause problems but something similar to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data control;
   do value =  233, 234,235,236,237,238,333, 334, 335, 336,450, 451,452,453 to 459;
   output;
   end;
run;


data _null_;
   set control;
   length str $ 100;
   str = cats('DATA see.a',value,'&amp;amp;Tid_num.;');
   call execute (str);
   str = cats('SET abb.abb_',value,';');
   call execute (str);
   call execute ('WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
   RUN;');
run;&lt;/PRE&gt;
&lt;P&gt;may do what you are attempting if I interpretted all of the places you are using those values correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you would not need the macro YRMO at all. The single quotes are intentional to keep the macro values from attempting to&lt;/P&gt;
&lt;P&gt;resove while the data _null_ step is compiling.&lt;/P&gt;
&lt;P&gt;If your Tid_num, nac or mac macro variables are supposed to be somehow connected to the values of the control variable that has not been mentioned up til now.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 17:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360494#M84882</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-22T17:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360499#M84884</link>
      <description>&lt;P&gt;The data step DO statement is much more powerful than the macro %DO statement.&lt;/P&gt;
&lt;P&gt;Perhaps you can generate the code using a data step instead of a macro?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i=233 to 238, 333 to 336, 450 to 459 ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 May 2017 17:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360499#M84884</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-22T17:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360502#M84886</link>
      <description>&lt;P&gt;yes, thank you. I got some error messages about the code above&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 18:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360502#M84886</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2017-05-22T18:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360503#M84887</link>
      <description>&lt;P&gt;If you want to use the supplied macro but skip unexisting input dataset, you can do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nac = ...;  /* any given value */
%let mac = ...; /* any given value */
%macro yrmo(N) 
   %do I= 233  %To &amp;amp;N; &lt;BR /&gt;       %if %sysfunc(exist(abb.abb_&amp;amp;i)) %then %do;
         DATA see.a&amp;amp;i.&amp;amp;Tid_num.; 
           SET abb.abb_&amp;amp;i; 
                  WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
          RUN;&lt;BR /&gt;       %end;
    %end; 
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 May 2017 18:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360503#M84887</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-05-22T18:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360510#M84891</link>
      <description>&lt;P&gt;That is great. Thank you.&amp;nbsp; my next step will be to put all these datasets generated into one single file, something like below. I do not know how to do it efficiently instead of copy and pasting....&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; see.bl&amp;amp;TID_NUM. ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; see. &lt;SPAN&gt;a&lt;/SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ….&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 18:43:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360510#M84891</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2017-05-22T18:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: how do I replace numbers with do loop macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360530#M84902</link>
      <description>&lt;P&gt;You cannot use same input name and mean different input datasets &amp;nbsp;(all are:&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;see. &lt;/SPAN&gt;&lt;SPAN&gt;a&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;i.&amp;amp;TID_NUM&lt;/SPAN&gt;&lt;/STRONG&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In previous code you have selected observation (criteria -&amp;nbsp;&lt;CODE class="  language-sas"&gt;&lt;STRONG&gt;&lt;SPAN class="token statement"&gt;WHERE&lt;/SPAN&gt; v1 &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"&amp;amp;nac"&lt;/SPAN&gt; OR v2 &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"&amp;amp;mac"&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="token punctuation"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;creating new set of datasets with a new name (new suffix).&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;Do you realy need all discrete files or just the unified one ?&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;If unified is enough do it in one, same step:&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nac = ...;  /* any given value */
%let mac = ...;  /* any given value */&lt;BR /&gt;%let Tid_num = ... ;  /* any given value */
%macro yrmo(N);
    DATA see.bl&amp;amp;Tid_num.;   /* unified output dataset name */
      SET
   %do I= 233  %To &amp;amp;N;    
            /* generating list of existing datasets */ 
            %if %sysfunc(exist(abb.abb_&amp;amp;i)) %then %str( abb.abb_&amp;amp;i );
    %end; 
      ;  /* closing SET list of datasets */
     
             WHERE v1 = "&amp;amp;nac" OR v2 = "&amp;amp;mac"; 
    RUN;       %end;
%mend yrmo; 
%yrmo(459); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are not satisfied with results or have any issues the code please supply the full log.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 19:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-replace-numbers-with-do-loop-macro/m-p/360530#M84902</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-05-22T19:35:00Z</dc:date>
    </item>
  </channel>
</rss>

