提问人:Hack-R 提问时间:5/18/2015 更新时间:5/18/2015 访问量:538
运行 SAS 脚本的计划 .bat 文件无法分配库,但在手动运行时工作?
Scheduled .bat file running SAS script fails to assign library but works when manually run?
问:
我有一个计划任务,应该每天运行一个SAS脚本。但是,它不成功,并导致 的结果。0x2
文件很简单:.bat
"E:\Program Files\SAS\SASFoundation\9.2\Sas.exe" -sysin "C:\Documents and Settings\username\Desktop\myfolder\myscript.sas"
我已经记录了输出,它表明问题在于一个库(并且只有许多库中的一个库)没有被成功分配:
2 libname COOLDB ORACLE user=Laureate pw=mypass path=COOLDB schema=ODSMGR;
NOTE: Libref COOLDB was successfully assigned as follows:
Engine: ORACLE
Physical Name: COOLDB
3 %let prj = T:\DNA\New Orleans\username\SAS Export Folder;
4 libname dt "&prj.";
NOTE: Library DT does not exist.
其中包含第一行只是为了证明它一直工作到那时。
这对我来说很奇怪,因为我 100% 确定被引用的文件夹/库存在并具有适当的权限。
当我手动运行相同的脚本时,没有问题:
3 %let prj = T:\DNA\New Orleans\username\SAS Export Folder;
4 libname dt "&prj.";
NOTE: Libref DT was successfully assigned as follows:
Engine: V9
Physical Name: T:\DNA\New Orleans\username\SAS Export Folder
答:
4赞
Bendy
5/18/2015
#1
根据服务器的不同,某些系统不喜欢空格(如 中所示),因此在这些情况下,您需要确保 libname 语句中的路径用引号括起来。SAS Export Folder
正如 Joe 所指出的,不要在引号上加倍,所以将路径传递为:
%let prj=%str(T:\DNA\New Orleans\username\SAS Export Folder);
libname dt "&prj.";
-或-
%let prj=%str("T:\DNA\New Orleans\username\SAS Export Folder");
libname dt &prj;
评论
3 %let prj = %str("T:\DNA\New Orleans\username\SAS Export Folder"); 4 libname dt "&prj."; ERROR: Libref in LIBNAME statement must be followed either by quoted string or engine name or semicolon; """T" found. ERROR: Error in the LIBNAME statement.
%str()