<?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: Loop through (with a macro) over multiple user defined %LET= in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373960#M89489</link>
    <description>&lt;P&gt;RW9 thank you but the last call execute is not working because the "TABLE" statement is missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2017 13:23:08 GMT</pubDate>
    <dc:creator>Zeus_Olympous</dc:creator>
    <dc:date>2017-07-07T13:23:08Z</dc:date>
    <item>
      <title>Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373862#M89444</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question might be extremely trivial.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to create a series of macro lists of variable names from a dataset i.e.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET&amp;nbsp;varlst1 =&lt;SPAN&gt;&amp;nbsp;a b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%LET varlst2&amp;nbsp;= a b c;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%LET&amp;nbsp;varlst2&amp;nbsp;= a b c d;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%LET&amp;nbsp;varlst2&amp;nbsp;= a b c d e;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%LET&amp;nbsp;varlst2&amp;nbsp;= a b c d e f;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and then use a macro to apply the above %lLET= &amp;nbsp;lists to a series of data steps i.e.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%macro repeat (var_list);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc sort data=dsn_test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by &amp;amp;var_list.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...more code...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%var_list(&amp;amp;varlst1&amp;nbsp;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%var_list(&amp;amp;varlst2 );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%var_list(&amp;amp;varlst3 );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%var_list(&amp;amp;varlst4 );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would greatly appreciate hints/tips how to automate this process.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanking you in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 09:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373862#M89444</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-07T09:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373869#M89448</link>
      <description>&lt;P&gt;Assuming that %REPEAT works properly, don't change it. &amp;nbsp;Instead, write a second macro to loop through the existing sets of variable lists:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro loop (n_loops=);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;%local i;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;%do i=1 %to &amp;amp;n_loops;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %repeat (&amp;amp;&amp;amp;varlist&amp;amp;i)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;%end;&lt;/P&gt;
&lt;P&gt;%mend loop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%loop (n_loops=4)&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 12:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373869#M89448</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-07T12:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373878#M89452</link>
      <description>&lt;P&gt;Could I ask to what end. &amp;nbsp;I have found it is almost never the simplest solution to start creating macros lists and macro loops, and in all those cases a simple change to the data or method of processing can vastly simplfy the code. &amp;nbsp;If you can show what your doing further on in the process and what you want out further code can be provided.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 10:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373878#M89452</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-07T10:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373925#M89475</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually I want to run PROC TABULATE based on each and every %LET combination and my goal is to combine all output datasets from PROC TABULATE, run within the macro, in one single dataset so I will be able to compare the various results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 12:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373925#M89475</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-07T12:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373938#M89480</link>
      <description>&lt;P&gt;Well, its hard to say without seeing data/code, but you should be able to do all that in one step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  a=1; b=2; c=3; d=34;
run;

proc tabulate data=have out=want;
  class a b c d;
  table a * b * c * d;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, you can get exactly the same results doing a datastep, i.e.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array vars{4} a b c d;
  array results{4} 8.;
  do i=...;
...
run;
&lt;/PRE&gt;
&lt;P&gt;Or a few other procedures. &amp;nbsp;You could also normalise your data from:&lt;/P&gt;
&lt;P&gt;a b c d&lt;/P&gt;
&lt;P&gt;1 2 3 4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;var &amp;nbsp;res&lt;/P&gt;
&lt;P&gt;a &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;b &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;c &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;then its simply a matter of where clausing.&lt;/P&gt;
&lt;P&gt;However if you insist on code generation:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  do i="a b","a b c","a b c d";
    call execute('proc tabulate date=have;  class'||strip(i)||'; run;');
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jul 2017 12:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373938#M89480</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-07T12:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373960#M89489</link>
      <description>&lt;P&gt;RW9 thank you but the last call execute is not working because the "TABLE" statement is missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 13:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373960#M89489</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-07T13:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373962#M89490</link>
      <description>&lt;P&gt;Yep, you would need to update it with your code, which I cannot see.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 13:31:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/373962#M89490</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-07T13:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374250#M89592</link>
      <description>&lt;P&gt;Dear RW9 ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help..I followed your instructions but I fail to produce for each call execute run different names in the output sets of PROC tabulate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example when i="sex" then&lt;/P&gt;&lt;P&gt;I need &lt;STRONG&gt;out=&lt;FONT color="#0000FF"&gt;pret1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;when i="sex age"&amp;nbsp;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;I need&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;out=&lt;FONT color="#0000FF"&gt;pret2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to utilize&amp;nbsp;%sysfunc(countw(&amp;amp;i%str( ))) but I cannoot make it work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any hint would be more than welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please see sample code and code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input ID $ 1-4 Sex $ 6 Age 8-9 Height 11-12 Weight 14-16&lt;BR /&gt;Pulse 18-20 FastGluc 22-24 PostGluc 26-28;&lt;BR /&gt;datalines;&lt;BR /&gt;2304 F 16 61 102 100 568 625&lt;BR /&gt;1128 M 43 71 218 76 156 208&lt;BR /&gt;4425 F 48 66 162 80 244 322&lt;BR /&gt;1387 F 57 64 142 70 177 206&lt;BR /&gt;9012 F 39 63 157 68 257 318&lt;BR /&gt;6312 M 52 72 240 77 362 413&lt;BR /&gt;5438 F 42 62 168 83 247 304&lt;BR /&gt;3788 M 38 73 234 71 486 544&lt;BR /&gt;9125 F 56 64 159 70 166 215&lt;BR /&gt;3438 M 15 66 140 67 492 547&lt;BR /&gt;1274 F 50 65 153 70 193 271&lt;BR /&gt;3347 M 53 70 193 78 271 313&lt;BR /&gt;2486 F 63 65 157 70 152 224&lt;BR /&gt;1129 F 48 61 137 69 267 319&lt;BR /&gt;9723 M 52 75 219 65 348 403&lt;BR /&gt;8653 M 49 68 185 79 259 311&lt;BR /&gt;4451 M 54 71 196 81 373 431&lt;BR /&gt;3279 M 40 70 213 82 447 504&lt;BR /&gt;4759 F 60 68 164 71 155 215&lt;BR /&gt;6488 F 59 64 154 75 362 409&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;do i="sex","sex age";&lt;BR /&gt;call execute('proc sort data=test; by '||strip(i)||'; run;');&lt;BR /&gt;call execute(' &amp;nbsp;proc tabulate data=test &lt;STRONG&gt;out=pret&amp;amp;c.;&lt;/STRONG&gt; class '||strip(i)||'; var pulse; table '||strip(i)||' ALL = "Grand Total" , pulse = "Group I" * (N="Count" COLPCTN="%");&lt;BR /&gt;Run; run;');&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 13:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374250#M89592</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-09T13:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374251#M89593</link>
      <description>&lt;P&gt;and unfortunately CALL EXECUTE does not iterate over i values "sex" , "sex age"....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the second DO LOOP iteration uses again the value of i="sex" instead of i="sex age"....&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 13:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374251#M89593</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-09T13:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374252#M89594</link>
      <description>&lt;P&gt;If you generating the sequence using a data step then the counter must be in the data step also. &amp;nbsp;Change the name of the variable with that has the list of variable names and add another variable that is the counter. &amp;nbsp;Then you can generate the numbered dataset name with code like:&amp;nbsp;cats('pret',i).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you overall data step might look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do vars="sex","sex age";
    i+1;
    call execute(catx(' '
      ,'proc sort data=test; by',vars,'; run;'
    ));
    call execute(catx(' '
      ,'proc tabulate data=test out=',cats('pret',i),';'
      ,'class',vars,';'
      ,'var pulse;'
      ,'table',vars,'ALL="Grand Total"'
      ,', pulse="Group',i,'" * (N="Count" COLPCTN="%");'
      ,'run;'
    ));
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 13:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374252#M89594</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-09T13:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374257#M89597</link>
      <description>&lt;P&gt;Dear Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much. Your code does create different output sets on each DO LOOP iteration but the problem is that does not update the list of variables from iteration to iteration.&lt;/P&gt;&lt;P&gt;It should be for i=1 &amp;nbsp;&lt;/P&gt;&lt;P&gt;table sex&lt;/P&gt;&lt;P&gt;for&amp;nbsp;&lt;/P&gt;&lt;P&gt;i=2&amp;nbsp;&lt;/P&gt;&lt;P&gt;table sex age&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it iterates only for the first value of i="sex"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please see attached the log&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter dijitContentPaneSingleChild"&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitAlignCenter dijitContentPaneSingleChild dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane"&gt;&lt;DIV class="tabs dijitBorderContainer dijitContainer dojoDndTarget sasStudioTabsParentContainer dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasStudioTabsTabContainer sasStudioTabsTabContainerVertical sasStudioTabsTop dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer sasStudioTabsTabContainerChild dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dojoDndTarget dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasSuiteTabs dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 data test;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 input ID $ 1-4 Sex $ 6 Age 8-9 Height 11-12 Weight 14-16&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 Pulse 18-20 FastGluc 22-24 PostGluc 26-28;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65 datalines;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.TEST has 20 observations and 8 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;86 ;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;87 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;88&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;89 data _null_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;90 do vars="sex","sex age";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;91 i+1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;92 call execute(catx(' '&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;93 ,'proc sort data=test; by',vars,'; run;'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;94 ));&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;95 call execute(catx(' '&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;96 ,'proc tabulate data=test out=',cats('pret',i),';'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;97 ,'class',vars,';'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;98 ,'var pulse;'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;99 ,'table',vars,'ALL="Grand Total"'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;100 ,', pulse="Group',i,'" * (N="Count" COLPCTN="%");'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;101 ,'run;'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;102 ));&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;103 end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;104 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.06 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: CALL EXECUTE generated line.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 + proc sort data=test; by sex ; run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 20 observations read from the data set WORK.TEST.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.TEST has 20 observations and 8 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;2 + proc tabulate data=test out= pret1 ; class sex ; var pulse; table sex ALL="Grand Total" , pulse="Group 1 " * (N="Count"&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;COLPCTN="%"); run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 20 observations read from the data set WORK.TEST.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.PRET1 has 3 observations and 6 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE TABULATE used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.09 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.09 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;3 + proc sort data=test; by sex ; run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Input data set is already sorted, no sorting done.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;4 + proc tabulate data=test out= pret2 ; class sex ; var pulse; table sex ALL="Grand Total" , pulse="Group 2 " * (N="Count"&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;COLPCTN="%"); run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 20 observations read from the data set WORK.TEST.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.PRET2 has 3 observations and 6 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE TABULATE used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.04 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.05 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;105&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;106&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;107 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;120&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="dijitContentPane statusBar dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignBottom"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sun, 09 Jul 2017 14:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374257#M89597</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-09T14:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374258#M89598</link>
      <description>&lt;P&gt;the same happens for proc sort BY variables ..in all iterations BY runs only for variable "sex"&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 14:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374258#M89598</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-09T14:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374298#M89614</link>
      <description>&lt;P&gt;SAS will assign the type and length for a variable based on how it is first used. In this case it will be set to $3 to match 'sex'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;It just looked like it was using SEX on the second iteration because there was no room to store the rest of the value.&lt;/P&gt;
&lt;P&gt;Just define a length for the variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  length i 8 vars $200;
  do vars="sex","sex age";
    i+1;
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 17:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374298#M89614</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-09T17:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through (with a macro) over multiple user defined %LET=</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374306#M89619</link>
      <description>&lt;P&gt;Dear Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you a million!&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 18:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-with-a-macro-over-multiple-user-defined-LET/m-p/374306#M89619</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-07-09T18:59:44Z</dc:date>
    </item>
  </channel>
</rss>

