2017-04-03 59 views
0

我每小时在(基本SAS 9.4)中运行一些SAS查询。我想知道是否有任何方法可以安排这些按特定时间在特定时间运行?感谢您的帮助:)如何为每个小时创建基本SAS计划程序

+2

作为@pinegulf提到,通常最好是看看奉献调度解决方案,而不是使用SAS本身作为一个调度器。你在PC SAS或SAS服务器(什么操作系统?)?你在使用企业指南吗? EG有一些调度功能(我认为与Windows调度程序集成),而SAS BI服务器通常也具有集成的调度程序(LSF或其他)。 – Quentin

+0

我在Windows 7,64位操作系统中使用PC SAS。这是BASE SAS 9.4。在基地萨斯我能够做调度工作或不。谢谢 – Gagan

+0

在你有一个.sas文件后,在你的代码在你批量提交时可以工作。在Base SAS中,你可以使用Win调度程序来调度它。所以Win调度程序将运行类似于'C:\ Program Files \ ... \ sas.exe -sysin“C:\ .... \ MyProgram.sas”'。或一个.bat文件或任何脚本。 – Quentin

回答

0

我建议利用一些其他手段的时间进程。 (如cron选项卡或詹金斯)

但是这里有些东西可能有用。

%macro do_every_hour; 
%do %while(1); /*Does not end, so be sure what you do....*/ 

    data time; /*When the loop begins, stored to dataset*/ 
     begin=datetime(); 
    run; 

    %do_the_queries; /*Your own queries go here*/ 


    data time; /*How long did the queries take. */ 
     set time; 
     end=datetime(); 
     time_remain=(60-(end-begin)) <>0 ; /*Calculate the time for sleep if you want every hour. Make sure there are no negative values. */ 
     call symput("sleep_time", time_remain); /*Take the number to macro variable for clarity's sake.*/ 
    run; 

    %sysfunc(sleep(&sleep_time)); /*Here we wait for the next round.*/ 

%end; /*Do loop end.*/ 
%mend do_every_hour; 

%do_every_hour; 
+0

感谢您的帮助:) – Gagan

相关问题