Hi experts!
I'm executing a sas program from linux command line, example:
/sas94/sashome/SASFoundation/9.4/sasexe/sas program.sas
I have to assign a libname to connect a sql server database to obtain the data, but I have this problem
ERROR: Could not load /sas94/sashome/SASFoundation/9.4/sasexe/sasodb (32 images loaded)
ERROR: /sas94/sapiq160/IQ-16_0/lib64/libodbc.so: version `VERS_3.52' not found (required by
/sas94/sashome/SASFoundation/9.4/sasexe/sasodb)
1 LIBNAME SAMPLE2 ODBC NOPROMPT="Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.6.so.1.1;SERVER=999.99.9.999,8888;
1 ! DATABASE=example1;UID=usr_XX;
2 PWD=ABCD" SCHEMA=dbo;
ERROR: The SAS/ACCESS Interface to ODBC cannot be loaded. The SASODB code appendage could not be loaded.
ERROR: Error in the LIBNAME statement.
I also have tried this: LIBNAME SAMPLE2 ODBC DATAsrc=NAMESRC_S SCHEMA=dbo USER=usr_XX PASSWORD="{SAS222}828A4PP5CB131A25BC" ;
and I obtain the same error.
BUT, when I do it from SAS enterprice Guide, both libname staments work fine!
any idea?
As @Quentin proposes: Use sasbatch.sh for your SAS batch jobs. This .sh gets built as part of a SAS installation and calls the .cfg and autoexec files that have been configure for your environment.
I've never had luck with using the NOPROMPT method from linux, but the second libname statement looks good to me:
LIBNAME SAMPLE2 ODBC DATAsrc=NAMESRC_S SCHEMA=dbo USER=usr_XX PASSWORD="{SAS222}828A4PP5CB131A25BC" ;
You get:
ERROR: The SAS/ACCESS Interface to ODBC cannot be loaded. The SASODB code appendage could not be loaded.
from that as well? When you run the batch job, are your running it on the same linux SAS server which EG is connected to?
I guess it's possible that EG is using a different config file when it launches SAS. The config file points to the ODBC connection info etc. You might be able to work with your SAS admin to figure out what config file (and possibly other option) EG is using.
The other possible path would be to use another metadata-aware SAS client to batch submit the program. My understanding is SAS Management Console can batch submit a program. I've also used DI studio to define a simple job with a single %include statement. Then if I deploy that job for scheduling, DI studio writes a .sas file that can be batch submitted from a shell script.
On my linux server, the shell script (I think provided by sas is called sasbatch.sh). So if I run:
/opt/sas/sasconfig/.../BatchServer/sasbatch.sh -sysin /quentin/myprogram.sas -batch -noterminal
it will batch submit myprogram.sas. And I think the shell script loads the config files that are used by EG (or I guess by the batch server), and it does the metadata login etc. So all the stuff that EG automatically enables works.
As @Quentin proposes: Use sasbatch.sh for your SAS batch jobs. This .sh gets built as part of a SAS installation and calls the .cfg and autoexec files that have been configure for your environment.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.