<?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: Parallel processing for a do loop in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406853#M26122</link>
    <description>&lt;P&gt;The&amp;nbsp; code roughly looks like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro account ();
	
	PROC SQL;
		create table temp.base(
		    var1 length=8,
			var2 length=8,
			var3 length=8,
			var4 length=8,
			var5 length=8,
			var6 length=8,
			var7 length=8,
			);
	QUIT;

	%do i = 0 %to &amp;amp;number.;

		DATA _NULL_;
			*--- determine year-month of loop in sas date;
			YYYY_MM_SAS = INTNX("MONTH", "&amp;amp;MORT_S_DATE."D, &amp;amp;I.);
			CALL SYMPUTX ('YYYY_MM_SAS', YYYY_MM_SAS);

			*--- determine month of loop in YYYY_MM format;
			CALL SYMPUTX ('YYYY_MM', tranwrd(put(YYYY_MM_SAS, yymmd8.),"-","_"));

			*--- determine month of loop in YYYYMM format;
			CALL SYMPUTX ('YYYYMM', put(YYYY_MM_SAS, yymmn6.));
		RUN;

		DATA add&amp;amp;YYYY_MM._PERF;
			LENGTH 
				var1 length=8
				var2 length=8
				var3 length=8
				var4 length=8
				var5 length=8
				var6 length=8
				var7 length=8
			;
			SET arrears_credit (keep=var1 var2 
				where=(year_month=&amp;amp;YYYYMM.));
			SET ACCOUNT_&amp;amp;YYYY_MM. (KEEP =  var 1 var3 var4 var5 var6 var7
				)
				KEY = var1 / UNIQUE;

			
		RUN;

		PROC APPEND BASE = base DATA = add&amp;amp;YYYY_MM._PERF;
		RUN;

		PROC SQL;
			DROP TABLE add&amp;amp;YYYY_MM._PERF;
		QUIT;

	%end;
%mend account;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 Oct 2017 09:10:20 GMT</pubDate>
    <dc:creator>quarterpastix</dc:creator>
    <dc:date>2017-10-24T09:10:20Z</dc:date>
    <item>
      <title>Parallel processing for a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406823#M26119</link>
      <description>&lt;P&gt;I'm trying to reduce the computational time of a program which uses large datasets. The outline of the program is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.create an empty base table A.&lt;/P&gt;&lt;P&gt;2. do the following for I=0 to 35;&lt;/P&gt;&lt;P&gt;3.&amp;nbsp;&amp;nbsp;&amp;nbsp; create a table B_I;&lt;/P&gt;&lt;P&gt;4.&amp;nbsp;&amp;nbsp;&amp;nbsp; append the table B_I to A;&lt;/P&gt;&lt;P&gt;5. end do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone suggest me some possible techniques to reduce the computational time of the code or if the code can be run parallel by breaking it into small steps?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 07:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406823#M26119</guid>
      <dc:creator>quarterpastix</dc:creator>
      <dc:date>2017-10-24T07:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel processing for a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406830#M26120</link>
      <description>&lt;P&gt;Write the program in such a manner that table A is created in one step.&lt;/P&gt;
&lt;P&gt;You could only parallelize the creation of the individual datasets, but the append/concatenation has to be done by one process, as only one process can have write access to table A at any given time.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 07:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406830#M26120</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-24T07:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel processing for a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406846#M26121</link>
      <description>&lt;P&gt;Thats all well and good, but you haven't really shown us anything.&amp;nbsp; From what you post:&lt;/P&gt;
&lt;PRE&gt;data a;
  /* create empty table part */
  length var1 $20 var2 8;

  /* append data part */
  do i=1 to 35;
    /* insert tableb creation here */
  end;
run;&lt;/PRE&gt;
&lt;P&gt;By creatinig data separately and then appending you are creating 35 * read/writes plus headers for each of them.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 08:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406846#M26121</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-24T08:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel processing for a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406853#M26122</link>
      <description>&lt;P&gt;The&amp;nbsp; code roughly looks like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro account ();
	
	PROC SQL;
		create table temp.base(
		    var1 length=8,
			var2 length=8,
			var3 length=8,
			var4 length=8,
			var5 length=8,
			var6 length=8,
			var7 length=8,
			);
	QUIT;

	%do i = 0 %to &amp;amp;number.;

		DATA _NULL_;
			*--- determine year-month of loop in sas date;
			YYYY_MM_SAS = INTNX("MONTH", "&amp;amp;MORT_S_DATE."D, &amp;amp;I.);
			CALL SYMPUTX ('YYYY_MM_SAS', YYYY_MM_SAS);

			*--- determine month of loop in YYYY_MM format;
			CALL SYMPUTX ('YYYY_MM', tranwrd(put(YYYY_MM_SAS, yymmd8.),"-","_"));

			*--- determine month of loop in YYYYMM format;
			CALL SYMPUTX ('YYYYMM', put(YYYY_MM_SAS, yymmn6.));
		RUN;

		DATA add&amp;amp;YYYY_MM._PERF;
			LENGTH 
				var1 length=8
				var2 length=8
				var3 length=8
				var4 length=8
				var5 length=8
				var6 length=8
				var7 length=8
			;
			SET arrears_credit (keep=var1 var2 
				where=(year_month=&amp;amp;YYYYMM.));
			SET ACCOUNT_&amp;amp;YYYY_MM. (KEEP =  var 1 var3 var4 var5 var6 var7
				)
				KEY = var1 / UNIQUE;

			
		RUN;

		PROC APPEND BASE = base DATA = add&amp;amp;YYYY_MM._PERF;
		RUN;

		PROC SQL;
			DROP TABLE add&amp;amp;YYYY_MM._PERF;
		QUIT;

	%end;
%mend account;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Oct 2017 09:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406853#M26122</guid>
      <dc:creator>quarterpastix</dc:creator>
      <dc:date>2017-10-24T09:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel processing for a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406861#M26123</link>
      <description>&lt;P&gt;Yes, unfortunately a common&amp;nbsp;issue this one, and all caused by the fact that date is a part of the dataset name.&amp;nbsp; Think how much simpler the world would be if you had one dataset, with a fixed name and structure, and a column which contained the date, no looping or appending, just simple data.&amp;nbsp; I don't know where this thinking came in but it does seem to account for more than half the questions on this forum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways (not tested):&lt;/P&gt;
&lt;PRE&gt;%let mort_s_date=12JAN2014;
%let number=5;

data _null_;
  call execute('data base;');
  do i=1 to &amp;amp;number.;
    tmp=intnx("month","&amp;amp;mort_s_date."d, &amp;amp;i.);
    call execute('set arrears_credit (keep=var1 var2 where=(yearmonth='||put(tmp,yymm6.)||'));');
    call execute('set account_'||put(year(tmp),z4.)||'_'||put(month(tmp),z2.)||' (keep=var1 var3 var4 var5 var6 var7);');
  end;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 09:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parallel-processing-for-a-do-loop/m-p/406861#M26123</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-24T09:35:45Z</dc:date>
    </item>
  </channel>
</rss>

