<?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: sequentially designed datastep run codes within proc cas do not wait for its predecessor to fini in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962548#M375157</link>
    <description>&lt;P&gt;In your second DATA step, this statement:&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;		if first.timestamp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ensures that only the first record for each &lt;STRONG&gt;timestamp&lt;/STRONG&gt;&amp;nbsp;group is output. So the output data set from the second data step (&lt;STRONG&gt;casuser.result_groups_temp&lt;/STRONG&gt;) will most likely have significantly fewer observations than the input data set (&lt;STRONG&gt;casuser.origin_filtered_by_time&lt;/STRONG&gt;).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I emulated your process by loading the &lt;STRONG&gt;sashelp.cars&lt;/STRONG&gt; dataset to my &lt;STRONG&gt;casuser&lt;/STRONG&gt; caslib, and using it in a simplified form of your program. It all worked exactly as I would have expected...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Mar 2025 19:55:05 GMT</pubDate>
    <dc:creator>SASJedi</dc:creator>
    <dc:date>2025-03-24T19:55:05Z</dc:date>
    <item>
      <title>sequentially designed datastep run codes within proc cas do not wait for its predecessor to finish.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962341#M375088</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;I get bad results because they don't wait for each other.&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;The result is different from the one I egt when I run both datasteps one after another.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
function doesTableExist(casLib,casTable);
	table.tableExists result=r status=rc / caslib=casLib table=casTable;
	tableExists = dictionary(r, "exists");
	return tableExists;
end func;

source myDataStep;
	data casuser.origin_filtered_by_time;
		set &amp;amp;fname.;
		if timestamp &amp;gt;= input("&amp;amp;last_start_date.", datetime20.);
		keep timestamp var1; 
	run;
endsource;

source myDataStep1;
	data casuser.result_groups_temp / sessref="mySession"
		single=yes;
		set casuser.origin_filtered_by_time;
		by timestamp var1; 
		retain group_id;
		if lag(var1) ^= var1 then group_id + 1;
		if first.timestamp;
	run;
endsource;



/* check whether the process has been carried out at least once */
tableExists_watchdog = doesTableExist("&amp;amp;liby", "&amp;amp;casy_watchdog");

/* in that case, proceed with the following steps */
if tableExists_watchdog ^=0 then do;

	dataStep.runCode result=r status=rc /
		code=myDataStep;
	dataStep.runCode result=r status=rc /
		code=myDataStep1;


run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Mar 2025 18:21:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962341#M375088</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2025-03-20T18:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: sequentially designed datastep run codes within proc cas do not wait for its predecessor to fini</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962510#M375135</link>
      <description>&lt;P&gt;In what way is the result different from your expected result?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 14:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962510#M375135</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2025-03-24T14:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: sequentially designed datastep run codes within proc cas do not wait for its predecessor to fini</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962527#M375144</link>
      <description>&lt;P&gt;The final output table had less entries.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seemed to me that the second data step didn't wait for the first one to complete. As if it started setting the input table=output table from the first data step before it had all rows written to table.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 17:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962527#M375144</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2025-03-24T17:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: sequentially designed datastep run codes within proc cas do not wait for its predecessor to fini</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962548#M375157</link>
      <description>&lt;P&gt;In your second DATA step, this statement:&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;		if first.timestamp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ensures that only the first record for each &lt;STRONG&gt;timestamp&lt;/STRONG&gt;&amp;nbsp;group is output. So the output data set from the second data step (&lt;STRONG&gt;casuser.result_groups_temp&lt;/STRONG&gt;) will most likely have significantly fewer observations than the input data set (&lt;STRONG&gt;casuser.origin_filtered_by_time&lt;/STRONG&gt;).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I emulated your process by loading the &lt;STRONG&gt;sashelp.cars&lt;/STRONG&gt; dataset to my &lt;STRONG&gt;casuser&lt;/STRONG&gt; caslib, and using it in a simplified form of your program. It all worked exactly as I would have expected...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 19:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sequentially-designed-datastep-run-codes-within-proc-cas-do-not/m-p/962548#M375157</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2025-03-24T19:55:05Z</dc:date>
    </item>
  </channel>
</rss>

