How to assign SAS Libref in UNIX?

444 views Asked by At

We have been using EG to run SAS job manually, and I am trying to automated some of the SAS process using shell scripts. However, all the scripts that used to run in EG are now giving an error saying the Libref are not assign.

How can i assign/migrate all the libraries we have in EG to UNIX for all the SAS scripts to use?

This is one of the code i used to test:

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;

And the error i am getting:

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

Thanks

1

There are 1 answers

1
Allan Bowe On BEST ANSWER

In EG your CPP_SRC library was probably defined in metadata. Try running this macro with options mprint; to extract the SAS code you need to recreate the library in Unix.

In short, you need to create a new script which contains all your libname statements so they can be assigned in your Unix session.