SAS启动时自动执行代码

有时候我们希望SAS启动时自动执行已经编写好的程序,可以按照以下方法实现:

首先正常打开SAS,编写我们想要让SAS启动时自动执行的代码,例如获取桌面文件夹路径,以便在其他程序中引用这个路径。

proc sql noprint;
    %global desktop;
    select xpath into: desktop
        from dictionary.extfiles
            where substr(fileref, 8) = select max(substr(fileref, 8)) from dictionary.extfiles;
quit;

%let desktop = %sysfunc(compress(&desktop, %str( )));

然后右键SAS的快捷方式,选择“属性”,在目标一栏添加:-autoexec "autoexec_path",其中autoexec_path是想要自动执行的程序的物理路径。保存以后,只需双击SAS快捷方式即可自动执行设定的程序。

 

posted @ 2021-07-30 22:54  Snoopy1866  阅读(499)  评论(0编辑  收藏  举报