<?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: script shell to launch macro in sas server in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195375#M36756</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suppose having that polling in some code it will look like something&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let fdlstart_cntr=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do %while (&amp;amp;fdlstart_cntr ge 1 &amp;amp; &amp;amp;sysrc=0 ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %include yourcode(fdl_sasrun) ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let temp = %sysfunc( sleep(20,1) ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put fdlstart polling loop sleep=&amp;amp;fdlsleep no &amp;amp;fdlstart_cntr&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %include yourcode(fdl_checkrun) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put %sysfunc( sleep(40,1) ) wait some seconds.... ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let fdlstart_cntr=%eval(&amp;amp;fdlstart_cntr +1 );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if ( %sysfunc(fileexist(???._STOP) ) ) %then %let fdlstart_cntr=0;&amp;nbsp;&amp;nbsp; /* to stop the polling checking for a file created/existence */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose your SAS code fdl_sasrun is&amp;nbsp; having:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; seljobsubmit = 1 ;&amp;nbsp; /* a selection switcht allowing many testings */&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( fdl_status in (" ","W","w") ) then do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( jbwinstart &amp;gt; curdatetim &amp;amp; jbwinstart ne . ) then seljobsubmit = 0&amp;nbsp;&amp;nbsp; ;&amp;nbsp;&amp;nbsp; /* only after a time test */&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( fdl_status in (" ","W","w") &amp;amp; seljobsubmit = 1 ) then do; /* validate existence tables SAS-datasets */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to dim(trgdsn);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* work a list array of possible datasets as libname.dataset&amp;nbsp;&amp;nbsp; vivisible ot the polling process */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF ( trgdsn{i} ne ""&amp;nbsp; ) THEN do ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* only do the checking when being defined as string */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( not exist(trgdsn{i})&amp;nbsp; ) then&amp;nbsp;&amp;nbsp; seljobsubmit = 0 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* if the mentioned does not exists the job may not start */ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;/* many ohter possible tests can be added */h&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( seljobsubmit = 1 ) Then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( jbstatus in("W","w")&amp;nbsp; ) then fdl_status=" " ;&amp;nbsp;&amp;nbsp; /* after having waited now allowed to submit */&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( jbstatus = " " ) then&amp;nbsp; fdl_status="W"&amp;nbsp;&amp;nbsp; ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* not allowed to run yet, set status to wait */&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( fdl_status= " " ) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; submitstring=' .... '&amp;nbsp;&amp;nbsp; ;&amp;nbsp; /* whatever is needed as batchjob using x-cmd */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call execute(submitstring) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this can also be a mpconnect approach */ &lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose your SAS code fdl_checkrun is checking your code is started (delay assumed to be max 20 seconds by the OS */&lt;/P&gt;&lt;P&gt;Some dataset existence being created by a you sas job.&amp;nbsp; And the logic is getting completed,&lt;/P&gt;&lt;P&gt;Making all it all by parameters and it will become a more generic approach. That is almost similar to generic schedulers able to set triggers on existence of some dataset.&lt;/P&gt;&lt;P&gt;The strange thing here a compared to generic schedulers s as the SAS polling job can see those datamarts, no matter where they are created , the can be tested on an acted on.&amp;nbsp; (exist function)&lt;BR /&gt;When having access to a creation data/time refresh indicator that can also be set and coded. Only needing to know what should be tested on. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Apr 2015 19:09:52 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2015-04-16T19:09:52Z</dc:date>
    <item>
      <title>script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195370#M36751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Im looking for how to create a script Shell in the SAS EG Server to launch my macro (with parameters) &lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;Once&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;data mart&lt;/SPAN&gt; (in the server bibiotheques) &lt;SPAN class="hps"&gt;is&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;refreshed !&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;there is any solution ??&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;Thanks. to launch macro&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 09:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195370#M36751</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-14T09:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195371#M36752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that "Refresh" on a library can be used to trigger anything, if that's what you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 10:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195371#M36752</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-14T10:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195372#M36753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So can the script launch macro just by click (like vbs in windows to launch excel macros)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2015 09:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195372#M36753</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-15T09:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195373#M36754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use SAS for almost anything to start and check on conditions. Please avoid VBS complexity for that.&lt;/P&gt;&lt;P&gt;In the concepts you are asking for a scheduler that starts a process when a&amp;nbsp; external file exists.&lt;BR /&gt;When you do not have it, it can be build using SAS. The design:&lt;/P&gt;&lt;P&gt;- Build a poller that doe a checks and verifie every x-time and than goes asleep. The Sleep function exists with SAS.&lt;/P&gt;&lt;P&gt;- Start a verifying condition that can be anything like other job have been run, A sas-dataset existing (internal or even external dbms) it is really anything you can do with SAS.&lt;/P&gt;&lt;P&gt;- Having all conditions met do a remote submit (mp-connect) or batch submit with xcmd access use a intitstmt termstmt for checking status etc&lt;/P&gt;&lt;P&gt;- Validate the status of those running jobs and you can email or do something different/other task.&lt;/P&gt;&lt;P&gt;The sky is the limit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Launch a macro? I hope you are saying launching a sas-program. &lt;A href="http://en.wikipedia.org/wiki/Macro_(computer_science"&gt;http://en.wikipedia.org/wiki/Macro_(computer_science&lt;/A&gt;) macro with sas are soure text manipulating. They are NOT procedures or keyboard/mouse recordings. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2015 10:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195373#M36754</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-04-15T10:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195374#M36755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Karman, but i dont know how to do that !! Can you give me more explications ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 16:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195374#M36755</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-16T16:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195375#M36756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suppose having that polling in some code it will look like something&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let fdlstart_cntr=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do %while (&amp;amp;fdlstart_cntr ge 1 &amp;amp; &amp;amp;sysrc=0 ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %include yourcode(fdl_sasrun) ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let temp = %sysfunc( sleep(20,1) ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put fdlstart polling loop sleep=&amp;amp;fdlsleep no &amp;amp;fdlstart_cntr&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %include yourcode(fdl_checkrun) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put %sysfunc( sleep(40,1) ) wait some seconds.... ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let fdlstart_cntr=%eval(&amp;amp;fdlstart_cntr +1 );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if ( %sysfunc(fileexist(???._STOP) ) ) %then %let fdlstart_cntr=0;&amp;nbsp;&amp;nbsp; /* to stop the polling checking for a file created/existence */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose your SAS code fdl_sasrun is&amp;nbsp; having:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; seljobsubmit = 1 ;&amp;nbsp; /* a selection switcht allowing many testings */&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( fdl_status in (" ","W","w") ) then do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( jbwinstart &amp;gt; curdatetim &amp;amp; jbwinstart ne . ) then seljobsubmit = 0&amp;nbsp;&amp;nbsp; ;&amp;nbsp;&amp;nbsp; /* only after a time test */&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( fdl_status in (" ","W","w") &amp;amp; seljobsubmit = 1 ) then do; /* validate existence tables SAS-datasets */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to dim(trgdsn);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* work a list array of possible datasets as libname.dataset&amp;nbsp;&amp;nbsp; vivisible ot the polling process */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF ( trgdsn{i} ne ""&amp;nbsp; ) THEN do ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* only do the checking when being defined as string */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( not exist(trgdsn{i})&amp;nbsp; ) then&amp;nbsp;&amp;nbsp; seljobsubmit = 0 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* if the mentioned does not exists the job may not start */ &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;/* many ohter possible tests can be added */h&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( seljobsubmit = 1 ) Then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( jbstatus in("W","w")&amp;nbsp; ) then fdl_status=" " ;&amp;nbsp;&amp;nbsp; /* after having waited now allowed to submit */&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( jbstatus = " " ) then&amp;nbsp; fdl_status="W"&amp;nbsp;&amp;nbsp; ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* not allowed to run yet, set status to wait */&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ( fdl_status= " " ) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; submitstring=' .... '&amp;nbsp;&amp;nbsp; ;&amp;nbsp; /* whatever is needed as batchjob using x-cmd */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call execute(submitstring) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* this can also be a mpconnect approach */ &lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose your SAS code fdl_checkrun is checking your code is started (delay assumed to be max 20 seconds by the OS */&lt;/P&gt;&lt;P&gt;Some dataset existence being created by a you sas job.&amp;nbsp; And the logic is getting completed,&lt;/P&gt;&lt;P&gt;Making all it all by parameters and it will become a more generic approach. That is almost similar to generic schedulers able to set triggers on existence of some dataset.&lt;/P&gt;&lt;P&gt;The strange thing here a compared to generic schedulers s as the SAS polling job can see those datamarts, no matter where they are created , the can be tested on an acted on.&amp;nbsp; (exist function)&lt;BR /&gt;When having access to a creation data/time refresh indicator that can also be set and coded. Only needing to know what should be tested on. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 19:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195375#M36756</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-04-16T19:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195376#M36757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Karman, but my datamart exist &lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;permanently with same name, and &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="hps"&gt;it is&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;refreshed&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;with new data&lt;/SPAN&gt; each month. So i want my process to be executed after this refreshment.&lt;/P&gt;&lt;P&gt;Soory.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 09:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195376#M36757</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-17T09:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195377#M36758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So your datamart is refreshed by some already existing process, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How is this process controlled/triggered?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 09:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195377#M36758</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-17T09:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195378#M36759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nothing to be sorry, you did not tell anything of your datamart lay-out&amp;nbsp; technical background RDBMS or SAS datasets.&lt;/P&gt;&lt;P&gt;When it are SAS-datasets you have the ATTRN function retrieving the CRDATE value. &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67398/HTML/default/viewer.htm#p12uchp7hm5h2zn1om2ut816af7h.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/67398/HTML/default/viewer.htm#p12uchp7hm5h2zn1om2ut816af7h.htm"&gt;SAS(R) 9.4 Functions and CALL Routines: Reference, Third Edition&lt;/A&gt;&amp;nbsp;&amp;nbsp; Having a previous current one of that there you have another check.&lt;/P&gt;&lt;P&gt;When that datamarts are run maybe there can be made some agreement to create a file somewhere&lt;/P&gt;&lt;P&gt;When an external&amp;nbsp; DBMS the last update is sometimes available as dictionary information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do you recognize there is a new one?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 09:47:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195378#M36759</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-04-17T09:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195379#M36760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, its refreshed by MSI.&lt;/P&gt;&lt;P&gt;my datamarts looks like that:&lt;/P&gt;&lt;P&gt;Serveur&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SASApp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bibiotheque&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataMart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DM4_DATAMART&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DM4_DATAMART_201403&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DM4_DATAMART_201404&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DM4_DATAMART_201405&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DM4_DATAMART_201406&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DM4_DATAMART_201407&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DM4_DATAMART_201503&lt;/P&gt;&lt;P&gt;I know that there is a new one ( 'DM4_DATAMART')&amp;nbsp; when the last one in this list is 'DM4_DATAMART_201503'. So the new one ( 'DM4_DATAMART') contains April data.&lt;/P&gt;&lt;DIV dir="ltr"&gt;&lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 10:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195379#M36760</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-17T10:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195380#M36761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you explain what MSI is?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 11:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195380#M36761</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-17T11:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195381#M36762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, Management Information System (MIS)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 11:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195381#M36762</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-17T11:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195382#M36763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then put your code into a .sas file and have that run in batch mode, triggered by the same MIS once the datamart update is finished.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 11:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195382#M36763</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-17T11:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195383#M36764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the test is:&amp;nbsp; When DataMart.DM4_DATAMART_201504 exist (test the existence of a dataset) then you want to start your program for the April job processing?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Seems to me a daily check for that is sufficiënt.&lt;/P&gt;&lt;P&gt;A process being started every day on the desired time and that one does nothing when the mentioned condition is not met. &lt;/P&gt;&lt;P&gt;The mind switch is: do nothing even when started&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; instead of only being starting when the condition is fulfilled.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 11:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195383#M36764</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-04-17T11:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195384#M36765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karman, I tryed to do that:&lt;/P&gt;&lt;P&gt;%if (month(today) ge 2 &amp;amp; month(today) le 12) %then %do&lt;/P&gt;&lt;P&gt;%let mois2 = %eval(month(today) - 1);&lt;/P&gt;&lt;P&gt;%let annee2 = %eval(year(today));&lt;/P&gt;&lt;P&gt;%end&lt;/P&gt;&lt;P&gt;%else %do&lt;/P&gt;&lt;P&gt;%let mois2 = 1;&lt;/P&gt;&lt;P&gt;%let annee2 = %eval(year(today) - 1);&lt;/P&gt;&lt;P&gt;%end&lt;/P&gt;&lt;P&gt;%let done = 0;&lt;/P&gt;&lt;P&gt;%if (%sysfun(fileexist(DATAMART.DM4_DATAMART&amp;amp;annee2&amp;amp;mois2)) &amp;amp; (done = 0)) %then %do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %kpisgenerals(mois1 = &amp;amp;mois2, annee1 = &amp;amp;annee2); /*my macro */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; done = 1;&lt;/P&gt;&lt;P&gt;%end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the problem is that my loop will not stopped, it will be executed more than one time !! you see that ? how can i settle it ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 09:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195384#M36765</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-20T09:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195385#M36766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are mixing macro and data step code.&lt;/P&gt;&lt;P&gt;%if is macro code, but the month() and year() functions are data step functions and will be treated by the macro processor as plain text(!), so you get the condition (quotes for emphasis) "month(today)" ge "2", which is always true (the character "m" has a higher ordinal than the character "2").&lt;/P&gt;&lt;P&gt;I guess that you get complaints in your log about&lt;/P&gt;&lt;P&gt;%let mois2 = %eval(month(today) - 1);&lt;/P&gt;&lt;P&gt;like "operator not found in expression".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest to put your condition evaluation into a data _null_ step and, when you have verified that the data step activates the right branch (use a simple put "does this"; and put "does that"; to check), replace the put with a call execute to call the macro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 10:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195385#M36766</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-20T10:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195386#M36767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but the problem is not resolved yet !! the programm will be executed more than one time !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 10:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195386#M36767</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-20T10:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195387#M36768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post code and log.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 10:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195387#M36768</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-20T10:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195388#M36769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make your approach more simple to understand and code.&lt;/P&gt;&lt;P&gt; There is a format that gives you immediate yyyymm values&amp;nbsp; &lt;/P&gt;&lt;P&gt; &lt;A href="http://support.sas.com/documentation/cdl/en/leforinforref/63324/HTML/default/viewer.htm#n1k45hxg0vxohqn1ktr8k1tnmrn1.htm"&gt;http://support.sas.com/documentation/cdl/en/leforinforref/63324/HTML/default/viewer.htm#n1k45hxg0vxohqn1ktr8k1tnmrn1.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; options mprint mlogic symbolgen source2 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let today=%sysfunc(today());&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let fstmonth=%sysfunc(Putn(&amp;amp;today,yymmn6.) ) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;fstmonth ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* shows the yyyymm value you are needing&amp;nbsp; */ &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro kpisgenerals (mois1=,annee1=);&amp;nbsp;&amp;nbsp; /* your code as&amp;nbsp; macro set up as dummy, just checking dates */ &lt;BR /&gt;&amp;nbsp; %put -- &amp;amp;mois1 --&amp;nbsp;&amp;nbsp; &amp;amp;annee1&amp;nbsp; -- ;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* I do not have f DATAMART.DM4_DATAMART&amp;amp;fstmonth instead of that test for&amp;nbsp;&amp;nbsp;&amp;nbsp; test.have&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* The test you forgot is marking the run has finished. I create a data set for that&amp;nbsp; with a lastrun naming.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It will execute you macro only once a month no matter how many times you call checkrun ... shifting the days as for namings using the %eval&amp;nbsp; as you need&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro checkrun;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if (%sysfunc(exist(test.have ) ) And not %sysfunc(exist(test.lastrun_DM4_DATAMART&amp;amp;fstmonth) )&amp;nbsp; )&amp;nbsp; %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %kpisgenerals(mois1=%substr(&amp;amp;fstmonth,5,2), annee1 = %substr(&amp;amp;fstmonth,1,4)); /*my macro */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; data test.lastrun_DM4_DATAMART&amp;amp;fstmonth ;&amp;nbsp; /* mark job has run&amp;nbsp; */ &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; today=today(); format today date. ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end ;&amp;nbsp; &lt;BR /&gt;%mend;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;%checkrun;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 19:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195388#M36769</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-04-20T19:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: script shell to launch macro in sas server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195389#M36770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Thanks it works with this code:&lt;/P&gt;&lt;P&gt;filename mylib "/home/sassrv/user_folder/sasuser/adnane/projet_tdb_mustapha/myautocall"; &lt;/P&gt;&lt;P&gt;options mrecall;&lt;/P&gt;&lt;P&gt;options mautosource sasautos=(mylib sasautos)&amp;nbsp; mautolocdisplay;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro rrr();&lt;/P&gt;&lt;P&gt;%if (%sysfunc(month("&amp;amp;sysdate"d)) ge 2 &amp;amp; %sysfunc(month("&amp;amp;sysdate"d)) le 12) %then %do;&lt;/P&gt;&lt;P&gt;%let fdlmonth = %sysfunc(month("&amp;amp;sysdate"d));&lt;/P&gt;&lt;P&gt;%let mois2 = %eval(&amp;amp;fdlmonth - 2);&lt;/P&gt;&lt;P&gt;%let annee2 = %sysfunc(year("&amp;amp;sysdate"d));&lt;/P&gt;&lt;P&gt;%let fdlyear = %sysfunc(year("&amp;amp;sysdate"d));&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%else %do;&lt;/P&gt;&lt;P&gt;%let mois2 = 12;&lt;/P&gt;&lt;P&gt;%let fdlyear = %sysfunc(year("&amp;amp;sysdate"d));&lt;/P&gt;&lt;P&gt;%let annee2 = %eval(&amp;amp;fdlyear - 1);&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%if ( &amp;amp;mois2 lt 10) %then %do;&lt;/P&gt;&lt;P&gt;%let mois2 = 0&amp;amp;mois2;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%if (%sysfunc(exist(DATAM.DM4_DATAMART_&amp;amp;annee2&amp;amp;mois2)) And not %sysfunc(exist(sasuser.lastrun_&amp;amp;annee2_&amp;amp;mois2) )) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %kpisgenerals(mois1= &amp;amp;fdlmonth, annee1= &amp;amp;fdlyear);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; data sasuser.lastrun_&amp;amp;annee2_&amp;amp;mois2 ;&amp;nbsp; /* mark job has run&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; today=today(); format today date. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%rrr()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i would like to schedule itin gaol be executed once a day !! (im working in SAS EG 4.3) &lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;Can you&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;inform me about&lt;/SPAN&gt; that&lt;SPAN class="hps"&gt;&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;step by step&lt;/SPAN&gt;&lt;/SPAN&gt; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/script-shell-to-launch-macro-in-sas-server/m-p/195389#M36770</guid>
      <dc:creator>fadel</dc:creator>
      <dc:date>2015-04-22T11:21:23Z</dc:date>
    </item>
  </channel>
</rss>

