<?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: Seeking Elegant way to run iteration loop for multiple input datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607179#M176427</link>
    <description>&lt;P&gt;1. This is very odd. proc append should take a proportionally longer time as the number of observations grows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. What are you appending to? a SAS data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. This might answer your expressed need:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;append&lt;/SPAN&gt; FORCE base&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;PMS &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;TARGETMEANS2(firstobs=&amp;amp;first_obs_nb. obs=&amp;amp;last_obs_nb)&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;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do a macro loop to manage the observations being appended.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Nov 2019 02:41:47 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-11-27T02:41:47Z</dc:date>
    <item>
      <title>Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607161#M176416</link>
      <description>&lt;P&gt;Thanks to the SAS Community, I was able to create a Do loop that calls a macro and substitutes a text string, one at a time.&amp;nbsp; Long story short, while it works great, when the # of iterations starts to climb, the iteration per second balloons.&amp;nbsp; The root cause is that at the end of each iteration of the called macro, the resulting values are appended as a row in a results dataset.&amp;nbsp; Reading/writing that dataset slows as its size increases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I can resolve this by splitting the input dataset (testcomb2) containing the text string into multiple smaller datasets.&amp;nbsp; So, instead&amp;nbsp; of 1.6 million rows to be run in a row, I could create 16 smaller datasets of 100,00 rows; each set of 100,000 would be a discrete completion of the Do loop. That way, the size of the results file never gets to big to bog down.&amp;nbsp; I found some code that should accomplish splitting into distinct datasteps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose I could simply repeat the code for the iteration loop 16 times, each time naming a different one of the smaller input sets and creating a results dataset with a slightly different name, but I am sure smarter people than me can suggest a more eloquent method, especially since it needs to be scalable (1.6 million this run, 3.2 million (32 sets of 100,00) the next, 500,000 (5 sets of 100,000) etc, the next.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps, I don't need to split into smaller datasteps, simply tell the loop to process List Number 1-100,000, end the loop, then repeat the loop for 100,001 through 200,000, etc....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or, perhaps I don't need to split either the input dataset, or the # of iterations in the loop.&amp;nbsp; Rather, when the results dataset reaches 100,00 obs, it spits that out as finished and starts a new one (with a slightly different name counter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;**************************************************************************************;
** G-6: LOOPING MARCO                               								**; 
**************************************************************************************;
%ODSOff
%macro test;                                                                                                                            

proc sql noprint;
 select count(*) into :n
  from testcomb2
 ;
quit;

%do i=1 %to &amp;amp;n;
 data _null_;
  set testcomb2;
  where list_number = &amp;amp;i ;
  call symputx('changelist',combos2);
  run;  

%US13_TARGET_ANALYSIS;	
                                                                                                                                        
%end;                                                                                                                                   

%mend;                                                                                                                                  
                                                                                                                                        
%test
%ODSOn&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 01:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607161#M176416</guid>
      <dc:creator>mfp</dc:creator>
      <dc:date>2019-11-26T01:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607163#M176417</link>
      <description>&lt;P&gt;PROC APPEND is the right tool for adding data to a dataet that will eliminate have constantly read/write the same data over and over.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymac ...
...
%do ...
.... create dataset with the new observations, call it NEXT for example...
proc append base=all_results data=next force;
run;
%end;
%mend ;

* Make sure ALL_RESULTS is empty/non-existent before starting;
proc delete data=all_results;
run;
%mymac;

* Now analyze ALL_RESULTS ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Nov 2019 00:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607163#M176417</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-26T00:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607164#M176418</link>
      <description>&lt;P&gt;Thanks Tom.&amp;nbsp; Perhaps I did not explain correctly, its the act of appending that slows things down as the number of appended observations gets into the hundreds of thousands.&amp;nbsp; Is there a way to stop appending once the observations hits a limit (100,000) and start a new results dataset?&amp;nbsp; Alternatively, can the # of iterations be set to stop after that limit, and then the loop restarted at the 100,001 observation through the 200,00th, etc.&amp;nbsp; I could also limit the size of the input dataset to 100,000.&amp;nbsp; In all three alternatives, the idea is to limit the size of the appended dataset to 100,000 obs, regardless of whether you limit the input data, the # of iterations, or the size of the appending results dataset.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 01:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607164#M176418</guid>
      <dc:creator>mfp</dc:creator>
      <dc:date>2019-11-26T01:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607165#M176419</link>
      <description>&lt;P&gt;You need to provide a lot more information about what you are actually doing to get anything very useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is not hard to limit the number of observations read from a dataset. You could use OBS= dataset option. Or stop after a number of iterations of the data step.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 01:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607165#M176419</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-26T01:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607166#M176420</link>
      <description>&lt;P&gt;You haven't shown us the code in&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macroname"&gt;%US13_TARGET_ANALYSIS&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;so it's really hard to say how we can speed this up. I do agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;that PROC APPEND is the way to go. I also am sure that you can split the data up as you requested, and I am pretty sure that you won't need to do that, but we can't be sure without seeing your code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 01:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607166#M176420</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-26T01:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607169#M176422</link>
      <description>&lt;P&gt;I am not trying to speed up the called macro by changing the data steps, I am trying to speed it up limiting the results dataset to one that is no bigger than 100,000.&amp;nbsp; Of course, I also don't want to overwrite the dataset with each batch of 100,000.&amp;nbsp; So it has to have a slightly different name.&amp;nbsp; Here is the last step of the called macro, where the appending takes place:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc append FORCE base=PMS data=TARGETMEANS2;
run; 

%end;

%MEND US13_TARGET_ANALYSIS;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 01:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607169#M176422</guid>
      <dc:creator>mfp</dc:creator>
      <dc:date>2019-11-26T01:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607170#M176423</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;So it has to have a slightly different name. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;No it doesn't. You don't use it beyond that step do you? You append it to the final data set so it's only the&amp;nbsp;final data set you need unless you want to keep all the intermediary data sets for some reason. Make sure&amp;nbsp;to clean it up so you don't&amp;nbsp;accidentally re-use it but you don't necessarily need a unique name.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 01:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607170#M176423</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-26T01:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607171#M176424</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just the opposite Reeza, that is the final dataset.&amp;nbsp; I absolutely want to keep it forever, along with all of the other 100,000 obs datasets that are created.&amp;nbsp; It gets finalized in the step after the end of the iteration loop:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%US13_TARGET_ANALYSIS;	
                                                                                                                                        
%end;                                                                                                                                   

%mend;                                                                                                                                  
                                                                                                                                        
%test
%ODSOn

**************************************************************************************;
** G7: TURN PRINTING BACK ON AND SAVE RESULTS                           			**;
**************************************************************************************;
proc printto;
run;

data company.&amp;amp;Total;  
set pms;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In sum, it takes 2 hours to run 100,000 obs through the loop.&amp;nbsp; But to run 200,000 it takes 5 hours, 300,000 = 9 hours, etc.&amp;nbsp; So its mush faster to run 3 sets of 100,000, which will take 6 hours than 1 big set of 300,000 that will take 9 hours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 01:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607171#M176424</guid>
      <dc:creator>mfp</dc:creator>
      <dc:date>2019-11-26T01:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607179#M176427</link>
      <description>&lt;P&gt;1. This is very odd. proc append should take a proportionally longer time as the number of observations grows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. What are you appending to? a SAS data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. This might answer your expressed need:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;append&lt;/SPAN&gt; FORCE base&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;PMS &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;TARGETMEANS2(firstobs=&amp;amp;first_obs_nb. obs=&amp;amp;last_obs_nb)&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;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do a macro loop to manage the observations being appended.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2019 02:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607179#M176427</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-11-27T02:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607181#M176428</link>
      <description>&lt;P&gt;But you're appending it to a final data set while you loop. You only keep the final appended data set, why do you need the intermediate data sets?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a macro to split the data set by size and gives them unique names.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could just modify the macro to run the process in the middle and then drop it after as well, which is shown below in orange. The link below has the original code to just split the files if that's what you'd like to do.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/abc3c6ce1dbeedb84fe7f11da0603cda" target="_blank" rel="noopener"&gt;https://gist.github.com/statgeek/abc3c6ce1dbeedb84fe7f11da0603cda&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro split (dsn=, size=, outDsnPrefix=Split);

    %*Get number of records and calculate the number of files needed;
    data _null_;
        set &amp;amp;dsn. nobs=_nobs;
        call symputx('nrecs', _nobs);
        n_files=ceil(_nobs/ &amp;amp;size.);
        call symputx('nfiles', n_files);
        stop;
    run;

    %*Set the start and end of data set to get first data set;
    %let first=1;
    %let last=&amp;amp;size.;
    
    %*Loop to split files;
    %do i=1 %to &amp;amp;nfiles;
    
        %*Split file by number of records;
        data &amp;amp;outDsnPrefix.&amp;amp;i.;
            set &amp;amp;dsn. (firstobs=&amp;amp;first obs=&amp;amp;last);
        run;

&lt;FONT size="4" color="#FF6600"&gt;&lt;STRONG&gt;        %RunYourMacroHERE;

        proc append base=final data=&amp;amp;outDsnPrefix.&amp;amp;i. force;
        run;

        proc sql;
        drop table &amp;amp;outDsnPrefix.&amp;amp;i.;
        quit;
 &lt;/STRONG&gt; &lt;/FONT&gt;


        %*Increment counters to have correct first/last;
        %let first = %eval(&amp;amp;last+1);
        %let last = %eval((&amp;amp;i. + 1)*&amp;amp;size.);
    %end;
%mend split;

*Example call;
%split(dsn=sashelp.cars, size=50, outDsnPrefix=Split);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 03:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607181#M176428</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-26T03:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607187#M176429</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/277026"&gt;@mfp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using Proc Append elapsed times for adding 100T rows to a table with 1M rows or 100M rows won't differ that much. I've done a test in my environment and the elapsed time only doubled.&lt;/P&gt;
&lt;P&gt;I haven't tested it but I guess when there is an index on the base table then run times will increase more. So if there is an index and you'll adding a lot of slices then it's eventually better to first drop the index and re-create once you're done adding data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you've got SAS logs for processing with 100T, 200T and 300T records and you say that elapsed time doesn't increase linear then investigate the SAS logs to determine which step(s) actually increase exponentially. Is that really the append or something else? Let us know and then share at least the relevant code and log for these steps.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 03:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607187#M176429</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-26T03:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607188#M176430</link>
      <description>&lt;P&gt;Hmmm!&amp;nbsp; Is it possible the writing of the SAS log is causing the issue?&amp;nbsp; I did note that the log file was several hundred MB in size when I ran about 500T obs?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 03:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607188#M176430</guid>
      <dc:creator>mfp</dc:creator>
      <dc:date>2019-11-26T03:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607189#M176431</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/277026"&gt;@mfp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hmmm!&amp;nbsp; Is it possible the writing of the SAS log is causing the issue?&amp;nbsp; I did note that the log file was several hundred MB in size when I ran about 500T obs?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It certainly impacts on performance and you probably should reduce the logging level. But even several hundred MB don't explain the difference in run-times you observe unless you've got a very slow disk.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 03:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607189#M176431</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-26T03:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607282#M176487</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/277026"&gt;@mfp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am not trying to speed up the called macro by changing the data steps, I am trying to speed it up limiting the results dataset to one that is no bigger than 100,000.&amp;nbsp; Of course, I also don't want to overwrite the dataset with each batch of 100,000.&amp;nbsp; So it has to have a slightly different name.&amp;nbsp; Here is the last step of the called macro, where the appending takes place:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc append FORCE base=PMS data=TARGETMEANS2;
run; 

%end;

%MEND US13_TARGET_ANALYSIS;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Okay, you want to keep the existing data sets &lt;EM&gt;etc etc etc&lt;/EM&gt; but you have completely ignored the request to see your code so we can know what you are doing and make suggestions for improvement. So we don't know what you are doing, and so we can't advise.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 11:42:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607282#M176487</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-26T11:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607408#M176579</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/277026"&gt;@mfp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hmmm!&amp;nbsp; Is it possible the writing of the SAS log is causing the issue?&amp;nbsp; I did note that the log file was several hundred MB in size when I ran about &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;500T&lt;/STRONG&gt; &lt;/FONT&gt;obs?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're trying to process 500 trillion observations? You initially mentioned 1.6 million rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turn off all messages to the log except errors is a starting point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 16:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607408#M176579</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-26T16:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Seeking Elegant way to run iteration loop for multiple input datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607439#M176600</link>
      <description>&lt;P&gt;Any processing of data sets in a loop that can run to iterations in the 6-digit range, will be ineffecient. But is the macro loop really necessary?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically your outer macro loops over all observations in your input data TESTCOMB2, stores the value of variable &lt;EM&gt;combos2&lt;/EM&gt; in macro variable &lt;EM&gt;changelist&lt;/EM&gt;, and then calls the macro US13_TARGET_ANALYSIS, which takes the current value in the macro variable changelist as input and does something that results in one record, that is appended to an output data set TARGETMEANS2, so this data set finally has the same number of observations as the input data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without knowing what is stored in the macro variable &lt;EM&gt;changelist&lt;/EM&gt;, and what happens in the macro US13_TARGET_ANALYSIS, it is difficult to see if the loop and resulting appending can be avoided. But if it is possible to rethink the process and do the same in one data step with TESTCOMB2 as input and TARGETMEANS2 as output, it would run much faster. But you need to post an input sample and the whole macro US13_TARGET_ANALYSIS to get any further suggestions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 17:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Seeking-Elegant-way-to-run-iteration-loop-for-multiple-input/m-p/607439#M176600</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-11-26T17:19:35Z</dc:date>
    </item>
  </channel>
</rss>

