Sas 如何刷新文件视图

Sas 如何刷新文件视图,sas,enterprise-guide,Sas,Enterprise Guide,在Enterprise Guide 4.2中,除了从流程中删除文件然后重新打开文件外,是否还有其他方法可以刷新文件视图 我的Google fu没有提供答案(一种或另一种),我的SAS管理员说他不知道有什么办法(但如果我找到了,就告诉他) 如有明确的“否”(来自文件)或带有示例的“是”,将不胜感激 我有一个日志文件,当我从命令行(在EG之外)运行SAS程序时,它会被更新。我在EG中编辑代码,我想查看日志文件以查看结果。目前,我必须从我的流程中删除日志文件,然后重新打开它以查看更新的日志。从您上次

在Enterprise Guide 4.2中,除了从流程中删除文件然后重新打开文件外,是否还有其他方法可以刷新文件视图

我的Google fu没有提供答案(一种或另一种),我的SAS管理员说他不知道有什么办法(但如果我找到了,就告诉他)

如有明确的“否”(来自文件)或带有示例的“是”,将不胜感激



我有一个日志文件,当我从命令行(在EG之外)运行SAS程序时,它会被更新。我在EG中编辑代码,我想查看日志文件以查看结果。目前,我必须从我的流程中删除日志文件,然后重新打开它以查看更新的日志。

从您上次对问题的评论中,听起来您好像在服务器上运行非交互式SAS程序(从PuTTY会话),并与EG客户机一起查看日志文件,对吗?如果是这样,有更简单的方法来查看日志文件

当你提到PuTTY时,我假设你的服务器是UNIX。如果是这样,请使用带有
-f
选项的
tail
命令。例如,如果您的SAS程序名为“myprog.SAS”,它将创建一个名为“myprog.log”的日志文件,请在UNIX提示符下尝试以下命令:

tail -f myprog.log
-f
选项意味着在将行写入日志时继续将输出写入终端窗口。当你看腻了(或看到SAS的“工作结束”消息)时,键入字母“q”退出

例如,您打算成为实际执行SAS程序的应用程序。从UNIX提示符运行东西超出了设计范围(并且您会丢失所有这些很酷的EG功能),并且会丢失在元数据环境中为您设置的任何站点功能


如果我完全不正确,请澄清您的问题。

从您上次对问题的评论来看,听起来您好像在服务器上运行非交互式SAS程序(从PuTTY会话),并与您的EG客户端一起查看日志文件,对吗?如果是这样,有更简单的方法来查看日志文件

当你提到PuTTY时,我假设你的服务器是UNIX。如果是这样,请使用带有
-f
选项的
tail
命令。例如,如果您的SAS程序名为“myprog.SAS”,它将创建一个名为“myprog.log”的日志文件,请在UNIX提示符下尝试以下命令:

tail -f myprog.log
-f
选项意味着在将行写入日志时继续将输出写入终端窗口。当你看腻了(或看到SAS的“工作结束”消息)时,键入字母“q”退出

例如,您打算成为实际执行SAS程序的应用程序。从UNIX提示符运行东西超出了设计范围(并且您会丢失所有这些很酷的EG功能),并且会丢失在元数据环境中为您设置的任何站点功能


如果我完全偏离了基准,请澄清您的问题。

在SAS平台中使用SAS EG或SAS Studio时,如果计算节点托管在Linux机器上,我总是使用代码查看SAS创建的输出文件的内容;唯一的要求是您知道要浏览的文件的完整路径,并且您有权从中读取

简单的想法是使用通用数据步骤:

  • 访问该文件
  • 逐行阅读
  • 按内容、位置、行号等过滤数据
  • 将数据打印到SAS日志,以便在那里查看
  • 下面是一个简单的示例,可以帮助您继续:

    • 首先,我为测试创建一个文件。你已经有了!,所以用你的

      /* create a test file */
      data _null_;
        file '/folders/myshortcuts/test/file'; /* Note I'm using fullpath */
        put "The begining, :)";
        put "line 2 in my file is shy and likes to hide.";
        put "line 3, all good so far.";
        put "line 4 in my file is to remain private.";
        put "Finally the last line in my file!";
      run;
      
    • 然后,这里是读取其数据的代码

      data _null_;
        /*--------
          references which input file will be read
          setting variable 'theEnd'=1 when 
          reaches end-of-file 
          Note I'm using fullpath
          --------*/
        infile '/folders/myshortcuts/test/file' end=theEnd;
      
        /*--------
           reads one line at a time from input file 
           storing it in variable _infile_
          --------*/
        input;
      
        /*--------
          contents of file will be writen in the log, to keep it readable,
          mark where the contents of the file will follow
          --------*/
        if _n_=1 then
          put "-----start file ----";
      
        /*--------
          filter out shy, private or unwanted data
          --------*/
        if _n_ ne 4;  /* continue only if row number is not 4 */
        if indexw(_infile_,"shy") le 0; /* continue only if data does not contains 'shy' */
      
        /*--------
          write the data you want, complete line read in this case
          --------*/
        put _N_= "->" _infile_;
      
        /*--------
          mark where the data in the file has ended
          --------*/
        if theEnd then put "-----end file ----";
      run;
      
    • 您的SAS日志如下所示:

       NOTE: The infile '/folders/myshortcuts/test/file' is:
             Filename=/folders/myshortcuts/test/file,
             Owner Name=sasdemo,Group Name=sas,
             Access Permission=-rw-rw-r--,
             Last Modified=11Jan2017:22:42:56,
             File Size (bytes)=160
      
       -----start file ----
       _N_=1 ->The begining, :)
       _N_=3 ->line 3, all good so far.
       _N_=5 ->Finally the last line in my file!
       -----end file ----
      
       NOTE: 5 records were read from the infile '/folders/myshortcuts/test/file'.
             The minimum record length was 16.
             The maximum record length was 43.
       NOTE: DATA statement used (Total process time):
             real time           0.02 seconds
             cpu time            0.03 seconds
      

    在SAS平台中使用SAS EG或SAS Studio时,如果计算节点托管在Linux机器上,我总是使用代码查看SAS创建的输出文件的内容;唯一的要求是您知道要浏览的文件的完整路径,并且您有权从中读取

    简单的想法是使用通用数据步骤:

  • 访问该文件
  • 逐行阅读
  • 按内容、位置、行号等过滤数据
  • 将数据打印到SAS日志,以便在那里查看
  • 下面是一个简单的示例,可以帮助您继续:

    • 首先,我为测试创建一个文件。你已经有了!,所以用你的

      /* create a test file */
      data _null_;
        file '/folders/myshortcuts/test/file'; /* Note I'm using fullpath */
        put "The begining, :)";
        put "line 2 in my file is shy and likes to hide.";
        put "line 3, all good so far.";
        put "line 4 in my file is to remain private.";
        put "Finally the last line in my file!";
      run;
      
    • 然后,这里是读取其数据的代码

      data _null_;
        /*--------
          references which input file will be read
          setting variable 'theEnd'=1 when 
          reaches end-of-file 
          Note I'm using fullpath
          --------*/
        infile '/folders/myshortcuts/test/file' end=theEnd;
      
        /*--------
           reads one line at a time from input file 
           storing it in variable _infile_
          --------*/
        input;
      
        /*--------
          contents of file will be writen in the log, to keep it readable,
          mark where the contents of the file will follow
          --------*/
        if _n_=1 then
          put "-----start file ----";
      
        /*--------
          filter out shy, private or unwanted data
          --------*/
        if _n_ ne 4;  /* continue only if row number is not 4 */
        if indexw(_infile_,"shy") le 0; /* continue only if data does not contains 'shy' */
      
        /*--------
          write the data you want, complete line read in this case
          --------*/
        put _N_= "->" _infile_;
      
        /*--------
          mark where the data in the file has ended
          --------*/
        if theEnd then put "-----end file ----";
      run;
      
    • 您的SAS日志如下所示:

       NOTE: The infile '/folders/myshortcuts/test/file' is:
             Filename=/folders/myshortcuts/test/file,
             Owner Name=sasdemo,Group Name=sas,
             Access Permission=-rw-rw-r--,
             Last Modified=11Jan2017:22:42:56,
             File Size (bytes)=160
      
       -----start file ----
       _N_=1 ->The begining, :)
       _N_=3 ->line 3, all good so far.
       _N_=5 ->Finally the last line in my file!
       -----end file ----
      
       NOTE: 5 records were read from the infile '/folders/myshortcuts/test/file'.
             The minimum record length was 16.
             The maximum record length was 43.
       NOTE: DATA statement used (Total process time):
             real time           0.02 seconds
             cpu time            0.03 seconds
      

    你是指SAS文件还是非SAS文件?我想这没关系,但它是一个非SAS文件(实际上是一个日志)。我对你的单词选择感到困惑(可能是因为我主要是一个基本的SAS人员)。当你说“你的文件视图”时,你具体指的是什么;当你说“刷新”时,你指的是什么?这是服务器上的东西,并且独立于你的EG会话运行,你想定期查看吗?我已经更新了这个问题。我使用EG作为开发环境,但我使用Base SAS编程。您正在使用EG,就像许多人使用UltraEdit一样(还能够运行SAS批处理文件,并能很好地突出显示SAS语法)。奇怪的是,为什么不右键单击运行EG中的步骤,然后查看从中返回的日志?你是指SAS文件还是非SAS文件?我认为这无关紧要,但它是非SAS文件(实际上是日志)。我对你的单词选择感到困惑(可能因为我主要是一个基本的SAS人员)。当你说“你的文件视图”时,你具体指的是什么;当你说“刷新”时,你指的是什么?这是服务器上的东西,并且独立于你的EG会话运行,你想定期查看吗?我已经更新了这个问题。我使用EG作为开发环境,但我使用Base SAS编程