【问题标题】:Logging SAS scripts记录 SAS 脚本
【发布时间】:2009-11-11 08:13:20
【问题描述】:

我一直在开发大量的 Java、PHP 和 Python。所有这些都提供了出色的日志记录包(分别为 Log4J、Log 或日志记录)。这在调试应用程序时很有帮助。特别是如果应用程序无头运行。

现在,我有一个应该作为存储过程运行的 SAS 脚本。但是由于某种原因,一旦作为存储过程运行,执行似乎就运行得很慢。我想做一些日志记录,看看应用程序在做什么。 它正在这样做。所以我可以查明导致执行缓慢的代码。

我一直在寻找 SAS 中的一些日志记录解决方案,但到目前为止还没有找到任何东西。有什么我可以用的吗?附加到文本文件将是一个好的开始。但是记录到 Windows 事件日志或远程 syslog 服务会更好。

【问题讨论】:

    标签: logging sas


    【解决方案1】:

    有一个函数“ntlog”可以写入 Windows 事件日志。在this page 上有描述。

    【讨论】:

      【解决方案2】:

      另一种可能性是将日志重定向到文件。示例:

      %let logPath = d:\sas.log;
      
      /* Delete the old log */
      
      data _null_;
          logFile = "mylog";
          rc = filename(logFile,"&logPath");
          if rc = 0 and fexist(logFile) then
             rc = fdelete(logFile);
          rc = filename(logFile);
      run;
      
      option nonotes nosource;
      
      /* Redirect log to file */
      
      proc printto log = "&logPath";
      run;
      
      %put >> File logging started <<;
      
      %put ERROR: An error occured (macro);
      %put WARNING: A warning occured (macro);
      
      data _null_;
        put "ERROR: An error occured inside my data step";
      run;
      
      %put >> File logging ended <<;
      
      /* Turn standard logging on again */
      
      proc printto; 
      run;
      
      option notes source;
      
      %put NOTE: Back to session log;
      

      【讨论】:

        【解决方案3】:

        在 support.sas.com 上的快速搜索给了我这个链接。

        使用说明 34114:默认创建详细的 SAS® 存储过程服务器日志

        http://support.sas.com/kb/34/114.html

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-05-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多