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?
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)?
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.
If your library is defined in SAS metadata only, then you need to Pre-Assign it for it to be executed in batch mode:
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
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
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.