<?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: Wait until dataset is updated with today's data(date) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/880843#M348035</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36092"&gt;@Ranny&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;SAS help class dataset - proc transpose&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And how does that attachment relate to your question from 2 years ago?&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2023 00:35:48 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-06-15T00:35:48Z</dc:date>
    <item>
      <title>Wait until dataset is updated with today's data(date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704873#M216120</link>
      <description>&lt;P&gt;I have SAS dataset in below library -&lt;/P&gt;
&lt;P&gt;Libname XYZ "/unix/mypath/project/202012";&lt;/P&gt;
&lt;P&gt;SAS dataset -&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Project_dataset.sas7bdat&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above dataset has date_variable (mmddyy10.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what I want is - If above dataset is available with today's date 12/09/2020 then move to the next step otherwise wait until today's data is updated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can we do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Renny&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 21:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704873#M216120</guid>
      <dc:creator>Ranny</dc:creator>
      <dc:date>2020-12-09T21:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Wait until dataset is updated with today's data(date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704877#M216121</link>
      <description>&lt;P&gt;Am I correct in assuming that each day's dataset goes into a new folder? If so, IMO this is bad design as your LIBNAME has to point to a different folder each day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One approach would be to use the FILEEXIST function (&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n06xm8hwk0t0axn10gj16lfiri43.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n06xm8hwk0t0axn10gj16lfiri43.htm&amp;amp;locale=en&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to check if both the folder and dataset exist before doing any processing.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 22:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704877#M216121</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-12-09T22:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Wait until dataset is updated with today's data(date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704904#M216132</link>
      <description>&lt;P&gt;If the daily data is appended, you can just test the last observation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_; 
  set SASHELP.CLASS nobs=NOBS; 
  set SASHELP.CLASS point=NOBS; 
  DATE=AGE;
  call symputx('dateok', ifn(DATE='17jan1960'd,1,0)); 
  stop;
run;

%put &amp;amp;=dateok; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Otherwise, you can use a where clause:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data _null_; 
  call symputx('dateok', '0'); 
  set SASHELP.CLASS(where=(AGE=16)); 
  call symputx('dateok', '1'); 
  stop;
run;

%put &amp;amp;=dateok; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 00:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704904#M216132</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-12-10T00:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Wait until dataset is updated with today's data(date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704978#M216158</link>
      <description>&lt;P&gt;See this macro code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname XYZ "/unix/mypath/project/202012";

%macro wait_till_ready;
%local today modate x;
%let today = %sysfunc(today());
proc sql noprint;
select datepart(modate) into :modate
from dictionary.tables
where libname = "XYZ" and memname = "PROJECT_DATASET"
;
quit;
%if &amp;amp;sqlobs = 0
%then %do;
  %put "Dataset does not exist!";
  %abort cancel;
%end;
%do %while (&amp;amp;modate ne &amp;amp;today);
  %let x = %sysfunc(sleep(60,1)); /* wait a minute */
  proc sql noprint;
  select datepart(modate) into :modate
  from dictionary.tables
  where libname = "XYZ" and memname = "PROJECT_DATASET"
  ;
  quit;
  %if %sysfunc(today()) gt &amp;amp;today
  %then %do;
    %put "No new data for this day!";
    %abort cancel;
  %end;
%end;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro will check first if the dataset exists; if not, a message is issued and an error condition raised, and in a non-interactive session (batch), the session is terminated.&lt;/P&gt;
&lt;P&gt;It retrieves the modification timestamp from DICTIONARY.TABLES, extracts the date, and compares that to the rundate of the job. If the dates don't match, it waits for a minute,&lt;/P&gt;
&lt;P&gt;If the current date exceeds the rundate, a message is issued and the job/submit terminated abnormally.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 08:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/704978#M216158</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-10T08:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Wait until dataset is updated with today's data(date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/880830#M348029</link>
      <description>&lt;P&gt;SAS help class dataset - proc transpose&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 21:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/880830#M348029</guid>
      <dc:creator>Ranny</dc:creator>
      <dc:date>2023-06-14T21:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Wait until dataset is updated with today's data(date)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/880843#M348035</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36092"&gt;@Ranny&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;SAS help class dataset - proc transpose&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And how does that attachment relate to your question from 2 years ago?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 00:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wait-until-dataset-is-updated-with-today-s-data-date/m-p/880843#M348035</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-15T00:35:48Z</dc:date>
    </item>
  </channel>
</rss>

