BookmarkSubscribeRSS Feed
RaulME
Fluorite | Level 6

Hello,

 

We are trying to run a SAS project (.SAS). This project internally queries a library, but every time we have tried it via batch, it says that the library is not assigned, which is completely incorrect because it is indeed assigned.

 

The command we are using is as follows:

 

sas -nodms -batch -sysin Project.sas

 

Internally in .sas, it queries a table:

 

FROM Name.name_table

 

The error it indicates is:

 

ERROR: Libref Name is not assigned.

 

Would it be necessary to make any call to the library or its location before running the project?

 

 

6 REPLIES 6
Patrick
Opal | Level 21

If SAS throws an error that the library is not assigned then it's just that: The library is not assigned in the SAS environment where the code runs. 

 

Is there any environment like a SAS EG session where the exact same code does run? If so what's different? Is there a libname statement in the code or are you eventually using a pre-assigned library that doesn't get pre-assigned when running in batch (for example because you're not connecting to the SAS metadata server)?

RaulME
Fluorite | Level 6

It seems more likely that the issue is precisely the scenario you mentioned.

 

I'm attempting to execute a .sas file located on the same server as EG. Internally, this file creates a table in another library by selecting from a table previously registered in a library.

SASKiwi
PROC Star

If your library is defined in SAS metadata only, then you need to Pre-Assign it for it to be executed in batch mode:

SASKiwi_0-1711341447060.png

 

Kurt_Bremser
Super User

In a BI Server environment, do not use SAS for batch like this. Use the sasbatch.sh shell script from the SASApp/BatchServer directory.

You still may need to add code to the program file that you have in some autoexec mechanism that EG provides (code run when a server connection is established, and code run before every submission).

 

Edit: replaced WorkspaceServer with BatchServer

Ksharp
Super User
Maybe your LIBNAME statement is costing too much time.
Maybe you need to wait for a couple of seconds to execute the following code.
Like :

libname x odbc dsn=.... ;
data _null_;
call sleep(10,1);
run;

..........Your following code here.........
DrAbhijeetSafai
Pyrite | Level 9

I think there is a spelling error in the title of the topic. In the body of the message it is correct but in the title, there is an error. 

 

Thank you.

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Associate Data Analyst
Actu-Real

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 627 views
  • 1 like
  • 6 in conversation