2

是否有任何通用建议来识别正在执行的 SAS 代码/程序?

我的代码将在通用宏中执行,因此可以在存储过程、另一个宏、客户端 SAS 程序甚至是使用 IOM 通过中间层生成的 SAS 代码中调用。我想要可能的最高级别标识符..(如果再次运行相同的程序会返回相同结果的东西 - 所以进程 ID 不会有帮助)。

环境不是windows,所以这段代码没有帮助:

%put %sysget(SAS_EXECFILENAME);

此外,宏不一定是第一个被调用的程序(如果它甚至是一个程序) - 所以这段代码也没有帮助:

proc sql noprint;
select xpath into :progname
from sashelp.vextfl where upcase(xpath) like '%.SAS';
%put &progname;
4

1 回答 1

1

It sounds to me like you may need to think through how this is to be be used a little more. What if the same user has two sessions open running the same code? Should that use the same file name?

Can you simply make it a requirement of your piece of code that a certain variable must have been specified before your code will run? Otherwise return an error / abort further processing?

To answer your original question though I don't think this is possible.

于 2012-11-16T22:11:54.140 回答