2017-08-28 88 views
0

我们一直在使用EG来手动运行SAS作业,并且我正在尝试使用shell脚本来自动化一些SAS进程。但是,以前在EG中运行的所有脚本现在都会提供一个错误,说明Libref未分配。如何在UNIX中分配SAS Libref?

如何将EG中的所有库分配/迁移到UNIX以供所有SAS脚本使用?

这是我用来测试的代码之一:

proc sql print; 
connect using CPP_SRC as sql;     
create table RESULTS.dummy_tt2 as 
select * 
    from connection to sql(select * from bns_results.dummy_tt) ; 
disconnect from sql; 
quit; 

,我得到的错误:

NOTE: SAS initialization used: 
     real time   0.03 seconds 
     cpu time   0.02 seconds 

1   proc sql print; 
2   connect using CPP_SRC as sql; 
ERROR: Libref CPP_SRC is not assigned. 
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. 
3   create table RESULTS.dummy_tt2 as 
4   select * 
5    from connection to sql(
6       select * from bns_results.dummy_tt 
7       ) ; 
NOTE: Statement not executed due to NOEXEC option. 
8   disconnect from sql; 
NOTE: Statement not executed due to NOEXEC option. 
9   quit; 
NOTE: The SAS System stopped processing this step because of errors. 
NOTE: PROCEDURE SQL used (Total process time): 
     real time   0.00 seconds 
     cpu time   0.00 seconds 

感谢

+0

你需要具体,有很多可能的原因。你可以展示一个例子,还有一个日志?一种可能是它们是用windows文件分隔符('\')而不是unix('/')定义的。 –

+0

@AllanBowe我已经更新了示例。 'ERROR:Libref CPP_SRC'这一行没有被赋值,这让我认为我需要在Unix中初始化SAS库来运行它。 – user3646699

回答

0

在EG的CPP_SRC库中可能定义元数据。尝试运行这个macrooptions mprint;来提取您需要在Unix中重新创建库的SAS代码。

简而言之,您需要创建一个包含所有libname语句的新脚本,以便在Unix会话中分配它们。

+1

这个工程,我最终创建一个单独的autoexec_cpp.sas并使用它像这样'sas -insert autoexec“./autoexec_cpp.sas”test3.sas' – user3646699