<span class="token macrobound">%macro</span> team(seed)<span class="token punctuation">;</span>
<span class="token procnames">proc</span> <span class="token procnames">surveyselect</span> <span class="token procnames">data</span> <span class="token operator">=</span> mylib<span class="token punctuation">.</span>team
method <span class="token operator">=</span> srs
<span class="token function">n</span> <span class="token operator">=</span> <span class="token number">100</span>
out <span class="token operator">=</span> sample<span class="token operator">&</span>i
<span class="token comment">/*noprint*/</span>
seed<span class="token operator">=&seed</span><span class="token punctuation">;</span>
<span class="token procnames">run</span><span class="token punctuation">;</span>
<span class="token macrobound">%mend</span> team<span class="token punctuation">;</span>
<span class="token comment">***generation of 10 random samples, 100 persons each;<br /></span>%macro do_loop(dimension);
<span class="token macrostatement">%do</span> i<span class="token operator">=</span><span class="token number">1</span> <span class="token macrostatement">%to</span> <span class="token number">&dimension</span><span class="token punctuation">;<br /></span> %put echo seed&i:&&seed&i;
<span class="token macroname">%team(&&seed&i)</span><span class="token punctuation">;</span>
<span class="token macrostatement">%end</span><span class="token punctuation">;<br />%mend do_loop;<br />%put _user_;<br />%do_loop(1);*testing;<br />%do_loop(10);*ok, then, run whole loop!;<br /><br /></span> your two macro can be made easier to read if you have a parameter for macro team for the seed this makes the macro named team, unique and unit-testable , rather than tied to the macro array in the global symbol table. this makes the macro with the loop easy to test and then ramp up to call the team macro. We, helpful volunteers, had no way of knowing, from the phrasing of your original question, where the error was: 1. in the code which generated the macro array 2. in the loop, which you thought was apparent to you 3. in the surveyselect macro These ideas of separating the procedure from the loop for testing and development were laid out by me and Art Carpenter in http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Using_Lists_of_Macro_Variables Ron Fehd macro array maven
... View more