<?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: Run a code every hour in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876566#M346297</link>
    <description>&lt;P&gt;Is your hourly processing related to your "by minute" processing? Does one rely on the other or not?&amp;nbsp; If there is no interaction between the minute and the hourly processing then running to two separately is an option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you didn't really answer my question regarding over what time periods does your process run. Does it run 24 hours per day, every day, or only for certain hours on certain days? The more hours the processing runs, the more robust and reliable it has to be.&lt;/P&gt;</description>
    <pubDate>Thu, 18 May 2023 20:56:23 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2023-05-18T20:56:23Z</dc:date>
    <item>
      <title>Run a code every hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876357#M346249</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I have a code that runs every minutes.&lt;/P&gt;
&lt;P&gt;I want to add to that code a section (which contain quite a few data steps) that should be run every hour at 00:01 (hh:mm).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look like this added part could be something a macro inside the big one.&lt;/P&gt;
&lt;P&gt;Can you please help me with that?&lt;/P&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO _BREAK() ;
%DO %WHILE (   %sysevalf(%sysfunc(time())&amp;lt;'16:00:08't,boolean)  ) ;

	/*------ADDED part that run every hour---------*/

	/*My MAIN CODE*/

    %*Sleep until 5 seconds after the start of the next minute ;
    %put %sysfunc(wakeup("%sysfunc(putn(%eval(%sysfunc(intnx(minute,"%sysfunc( time(), time )"t,1))+5),time.))"t));
  %end ;
%mend ;&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;</description>
      <pubDate>Thu, 18 May 2023 03:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876357#M346249</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2023-05-18T03:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Run a code every hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876360#M346251</link>
      <description>&lt;P&gt;If something needs to run at very specific times I would suggest using an actual scheduling program to start a SAS batch job at the given time.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 03:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876360#M346251</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-05-18T03:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Run a code every hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876361#M346252</link>
      <description>&lt;P&gt;What hours does this process need to run for? Continuously, or only for certain hours and / or on certain days?&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 04:32:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876361#M346252</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-05-18T04:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Run a code every hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876444#M346262</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;My main code run every minutes.&lt;/P&gt;
&lt;P&gt;The added section need to run inside this main code but only need to be executed every hour (instead of every minute).&lt;/P&gt;
&lt;P&gt;That's why I will can't schedule that part as a separate job.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 13:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876444#M346262</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2023-05-18T13:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Run a code every hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876566#M346297</link>
      <description>&lt;P&gt;Is your hourly processing related to your "by minute" processing? Does one rely on the other or not?&amp;nbsp; If there is no interaction between the minute and the hourly processing then running to two separately is an option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you didn't really answer my question regarding over what time periods does your process run. Does it run 24 hours per day, every day, or only for certain hours on certain days? The more hours the processing runs, the more robust and reliable it has to be.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 20:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876566#M346297</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-05-18T20:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Run a code every hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876590#M346303</link>
      <description>&lt;P&gt;Thank you all.&lt;/P&gt;
&lt;P&gt;I think I got it as below.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO _BREAK() ;
%DO %WHILE (   %sysevalf(%sysfunc(time())&amp;lt;'16:00:08't,boolean)  ) ;

	/*------ADDED part that run every hour---------*/
		%let now=%sysfunc(time());%let hh=%sysfunc(hour(&amp;amp;now),z2.);%put &amp;amp;now;%put &amp;amp;hh;
		%let mm=%sysfunc(minute(&amp;amp;now),z2.);
		%put &amp;amp;mm;


		%macro run_hourly;
		%if &amp;amp;mm=1 %then %do;
			%put 'HERE we go';
		%end;
		%mend;
		%run_hourly;


	/*My MAIN CODE*/

    %*Sleep until 5 seconds after the start of the next minute ;
    %put %sysfunc(wakeup("%sysfunc(putn(%eval(%sysfunc(intnx(minute,"%sysfunc( time(), time )"t,1))+5),time.))"t));
  %end ;
%mend ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 May 2023 02:17:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-code-every-hour/m-p/876590#M346303</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2023-05-19T02:17:37Z</dc:date>
    </item>
  </channel>
</rss>

