我尝试从SAS导入/导出文件,而不使用导出向导。
据我所知,我的公司在unix服务器上运行SAS,而我想使用windows驱动器。我们在Citrix环境中使用SAS EG。
根据我们的IT人员,有一个UNIX目录映射到一个windows驱动器(反之亦然?)我应该能够访问SAS中的以下目录:
/sas_p/gridshared/sh/eg_data/b036081/
到目前为止,我得到的是:
proc export
data=work.exp1
outfile="/sas_p/gridshared/sh/eg_data/b036081/exp1_test.csv" dbms=csv;
run;
这会产生一个错误:
ERROR: Physical file does not exist, /sas_p/gridshared/sh/eg_data/b036081/exp1_test.csv.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set WORK.EXP1.
0 records created in /sas_p/gridshared/sh/eg_data/b036081/exp1_test.csv from WORK.EXP1.
然而,在日志的后面告诉我,文件是成功创建的。
NOTE: "/sas_p/gridshared/sh/eg_data/b036081/exp1_test.csv" file was successfully created.
...when显然它不在那里(我既不能看到也不能重新导入它)。
我错过了什么?我的代码中有明显的错误吗?
发布于 2017-12-01 12:11:27
在导出之前,您应该检查文件夹是否存在。
具有以下职能:
/**
*
* @dev Function to check if a file/folder is existing
* @param dsn The pathname of the file/folder to be checked
*
*/
%macro checkFile(dsn /*Enter a pathname Ex: C:\myfile.txt */);
%if %sysfunc(fileexist(&dsn)) %then
%do;
%put &dsn. exists.;
data _null_;call symputx("checkFile",1,'G');run;
%end;
%else
%do;
%put &dsn. not exists.;
data _null_;call symputx("checkFile",0,'G');run;
%end;
%mend checkFile;
%checkFile("/sas_p/gridshared/sh/eg_data/b036081/");
%put checkFile=&checkFile;
你们的出口
%checkFile("/sas_p/gridshared/sh/eg_data/b036081/exp1_test.csv");
%put checkFile=&checkFile;
它将提供有关日志中文件夹的信息。在重新尝试proc出口后。因为如果文件夹是存在的,就没有理由失败。
如果是否创建了输出,则重做checkFile。不要太担心警告信息,SAS有时会给你错误的信息。事实上,您的文件并没有创建,但是SAS确实给了您一条消息,表示它是可以的。
如果没有创建文件,请与管理员联系,这肯定是访问的问题。因为您确实按照预期使用了proc导出,尊重双引用和/用于linux环境系统。
致以敬意,
https://stackoverflow.com/questions/47592752
复制相似问题