确定 SAS 源文件的文件夹
当我在企业指南中打开SAS文件并运行它时,它会在服务器上执行。源文件本身位于生产站点或开发站点。然而,在这两种情况下,它都是在同一服务器上执行的。我希望能够告诉我的脚本将结果存储在相对文件夹中。但是,如果我写类似的内容,
libname lib_out xport "..\tmp\foobar.xpt";
就会收到错误,因为 SAS Enterprise Guide 进程的工作文件夹不是我的源文件的位置,而是服务器上的文件夹。并且文件夹 ..\tmp
在那里不存在。即使可以,服务器进程也没有该文件夹的写入权限。
我想确定 .sas
文件是从哪个文件夹加载的,并相应地设置工作文件夹。 它是 S:\Development\myproject\sas\foobar.sas
,在另一种情况下,它是 S:\Production\myproject\sas\foobar.sas
在一种情况下, 有可能吗?或者你会怎么做?
When I open a SAS file in enterprise guide and run it, it is executed on the server. The source file itself is located either on the production site or the development site. In both cases, it is executed the same server however. I want to be able to tell my script to store results in a relative folder. But if I write something like
libname lib_out xport "..\tmp\foobar.xpt";
I get an error, because the working folder of the SAS Enterprise Guide process is not the location of my source file, but a folder on the server. And the folder ..\tmp
does not exist there. Even if it would, the server process does not have write permission in that folder.
I would like to determine from which folder the .sas
file was loaded and set the working folder accordingly. In one case it's S:\Development\myproject\sas\foobar.sas
and in the other case it's S:\Production\myproject\sas\foobar.sas
It this possible at all? Or how would you do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 EG 的配置方式,您也许能够使用 syshostname 全局宏变量之类的东西来确定保存结果的位置:
如果没有,请尝试查看其他哪些全局或自动宏变量可以通过执行以下操作来帮助您a:
希望这有帮助
干杯
抢
Depending on the way EG is configured, you may be able to use something like the syshostname global macro variable to determine where to save your results:
If not, try looking at what other global or automatic macro variables may be able to help you by doing a:
Hope this helps
Cheers
Rob
好吧,这并不能准确回答你的问题,但我很容易获得这个宏,所以我想我会分享它。从这里您只需要进行一些字符串处理。
OK, this isn't going to answer your question exactly, but I have this macro easily available so I thought I would share it. From here you would just need to do a little string processing.