<?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 sas scripts based on condition in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183005#M46613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeti:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are scheduling systems that can run your job based on whether a file has been created, AutoSys comes to mind.&amp;nbsp; Far superior than&lt;/P&gt;&lt;P&gt;trying to re-invent the wheel and build your own scheduler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Nov 2014 15:50:26 GMT</pubDate>
    <dc:creator>OS2Rules</dc:creator>
    <dc:date>2014-11-24T15:50:26Z</dc:date>
    <item>
      <title>run sas scripts based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183002#M46610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am trying to run write a script to mimic a scheduler.&amp;nbsp; If some conditions meet, then I would like to run certain SAS files.&amp;nbsp; I was playing around and I was able to write the code to run SAS files but this is not exactly what I am looking for.&amp;nbsp; The SAS programs need to run simultaneously or in parallel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;%MACRO RUN_READY();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do i = 110 %to 151;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROC SQL noprint;&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; SELECT PRG_SEQ , TRIM(RUN_DIR)||TRIM(PROGRAM_NME) AS PRG&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; INTO :ISINREADY, :ISPRG&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; FROM &amp;amp;nkgds..MEDEXP_STG_READY_V&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; WHERE PRG_SEQ=&amp;amp;i;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %IF &amp;amp;ISINREADY =&amp;amp;I&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; %THEN %DO;&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; %NKG_SLEEP(5);&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; %START_STG_T(&amp;amp;I);&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; %include "&amp;amp;isprg";&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; &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; %END;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %NKG_SLEEP(2);&lt;/P&gt;
&lt;P&gt;%MEND RUN_READY;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are about 30 programs.&amp;nbsp; My objective is that if their status is 'READY', the program can run without manual intervention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem with the above code is that the next program only runs when the SAS program in the include function has completed.&amp;nbsp; Lot of these programs run for hours and totally independent from one another.&amp;nbsp; I'd like them to run simultaneously.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I run this code in Unix.&amp;nbsp; I did try X command but lot of the macros are defined elsewhere, hence giving macro not defined error.&amp;nbsp; I looked for some suggestions, but my search did not result in any helpful topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sure there is a simple way to fix this.&amp;nbsp; I would be very grateful, if anybody could help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2014 07:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183002#M46610</guid>
      <dc:creator>Yeti</dc:creator>
      <dc:date>2014-11-24T07:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: run sas scripts based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183003#M46611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would not try to do the scheduling inside a SAS program, as this is clearly an operating system-level task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best option is to use some real scheduling system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you dont't have access to one in your company/organization, you could try to use cron and make in conjunction with a wrapper shell script for the sas programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The makefile would contain the conditions and actions based on semaphore files for the jobs, and the wrapper script would write the semaphores when completing a job successfully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the best option is to go for a real scheduling system.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2014 10:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183003#M46611</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-11-24T10:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: run sas scripts based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183004#M46612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Kurt.&amp;nbsp; Eventually, I will have to play with the scheduler to schedule these jobs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the jobs were to run during a time period, then it would have been easy.&amp;nbsp; The jobs need to run when the data is ready.&amp;nbsp; This data is entered by the users manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will have to find the macros used in these jobs, put them in a separate file and include them in the sas programs for the X command to run successfully.&amp;nbsp; I will give that a shot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2014 15:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183004#M46612</guid>
      <dc:creator>Yeti</dc:creator>
      <dc:date>2014-11-24T15:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: run sas scripts based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183005#M46613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeti:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are scheduling systems that can run your job based on whether a file has been created, AutoSys comes to mind.&amp;nbsp; Far superior than&lt;/P&gt;&lt;P&gt;trying to re-invent the wheel and build your own scheduler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2014 15:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/run-sas-scripts-based-on-condition/m-p/183005#M46613</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2014-11-24T15:50:26Z</dc:date>
    </item>
  </channel>
</rss>

