通过SH文件运行SAS批处理作业:SAS脚本包含导出到csv的内容-在哪里/如何获取输出?
作为大学职员,我被允许在WRD上运行批处理作业。我按照说明,还创建了包装并发送了作业通过SH文件运行SAS批处理作业:SAS脚本包含导出到csv的内容-在哪里/如何获取输出?,sas,sh,wrds,Sas,Sh,Wrds,作为大学职员,我被允许在WRD上运行批处理作业。我按照说明,还创建了包装并发送了作业 #!/bin/bash #$ -cwd #$ -m abe #$ -M myemail@email.com echo "Starting Job at `date`" sas my_sas_script.sas echo "Ending Job at `date`" 我通过调用shell脚本 qsub my_program.sh 工作完成得很快!。在我的主目录中,我得到了日志文件o和e文件 在我的SAS脚本
#!/bin/bash
#$ -cwd
#$ -m abe
#$ -M myemail@email.com
echo "Starting Job at `date`"
sas my_sas_script.sas
echo "Ending Job at `date`"
我通过调用shell脚本
qsub my_program.sh
工作完成得很快!。在我的主目录中,我得到了日志文件o和e文件
在我的SAS脚本中,我有一个导出到CSV的行,但是,我不能在任何地方导出它。是因为SAS脚本没有成功运行吗?我必须调整代码吗?事实上,这是来自这个问题的代码,但不是作为一个不工作的宏,而是作为一个简单的代码;我首先从我的库开始,然后继续编写代码
编辑:我再次运行我的_program.sh并缩短了以下日志
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
.
.
.
35 data _v_&tables / view=_v_&tables;
36 set &taq_ds;
37 where symbol = &stock and
_
22
76
37 !
WARNING: Apparent symbolic reference STOCK not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name,
a quoted string, a numeric constant, a datetime constant,
a missing value, INPUT, PUT.
ERROR 76-322: Syntax error, statement will be ignored.
38 (time between '9:30:00't and '16:00:00't) and
39 mode = 12 and
40 EX = 'N';
ERROR: Syntax error while parsing WHERE clause.
41 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 3.39 seconds
cpu time 0.73 seconds
46 data xtemp2;
47 set _v_&tables;
47 set _v_&tables;
___
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
48 by symbol date time;
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
49 format itime rtime time12.;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
50 if first.symbol = 1 or first.date = 1 then do;
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
51
54 rtime = time;
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
55 iprice = bid;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
56 oprice = ofr;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
57 itime = &start_time;
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
58 end;
___
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
59
60 if time >= itime then do;
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
61 output;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
62 itime = itime + &interval_seconds;
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
63 do while(time >= itime);
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
64 output;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
65 itime = itime + &interval_seconds;
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
66 end;
___
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
67 end;
___
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
68 rtime = time;
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
69 iprice = bid;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
70 oprice = ofr;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
71 retain itime iprice oprice;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
73 run;
74
75 Title "Final output -- 1min interval";
76 proc print data=work.xtemp2 (obs=100);
ERROR: File WORK.XTEMP2.DATA does not exist.
77 var symbol date itime iprice oprice;
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
78 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements.
This might cause NOTE: No observations in data set.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
WARNING: Apparent symbolic reference STOCK not resolved.
NOTE: The SAS System stopped processing this step because of errors.
81 proc export data=work.xtemp2 outfile="/home/Output/
81 ! &filename" dbms=csv;
82 run;
83
84 DM 'log; file "/home/Logs/ &filename.log" replace';
WARNING: Apparent symbolic reference STOCKLOG not resolved.
84 !
85 DM "log; clear; ";
ERROR: Errors printed on page 2.
您的SAS程序似乎执行得很好,只是由于语法错误而无法完成,即在第一个实例中,宏变量STOCK未定义 我建议首先在SAS的常规干净实例中运行该程序,并确保它在没有错误的情况下完成 如果它在那里运行正常,但不是在shell批处理中运行,则必须存在以下问题之一: autoexec确保在批处理实例中运行相同的autoexec 配置检查正在使用的sasv9.cfg文件 用户权限批处理帐户是否与“成功”帐户具有相同的权限?
您在日志中得到了什么?请尝试导出单个表的简单程序,如sashelp.class-显示代码和日志。如果它不工作,可能是因为主机系统安全策略。如果sashelp.class导出确实有效,但仍然无法找到输出,这将是一个令人费解的问题。如果导出路径没有特别设置,输出应该转到当前的工作文件夹,这不是工作文件夹亲爱的,非常感谢;我将运行Richard suggestion,然后发布日志。看起来您的宏var股票定义不正确。在执行步骤之前,数据步骤将始终获取变量的值。所以,在这种情况下,要么变量没有带引号的字符串use&stock,要么值不一致feed issue。我已将该变量定义为宏变量:%let stock='COP';使用'而不是引号。事实上,我没有多个set语句,而是有一个数据步骤视图,然后是实际的数据步骤。