How can I assign libname to WORK Data Library in SAS?

Sale picture Sale · Jun 25, 2015 · Viewed 7.5k times · Source

we have a Enterprise Guide Project, where we have multiple process flows. Output of each process flow is saved to specific Library called "SAVE", defined with LIBNAME statement. This is done so that we could easier jump and work on any process flow without needing to run all above process flows (except of course the process flow which would initialize SAVE Library with LIBNAME statement).

However, when we want to run this code on PRODUCTION server, we would like that this SAVE Library points to SAS WORK Data Library, as we dont need this in-between data.

Is it possible to direct the Library to WORK Data Library, using LIBNAME Statement (e.g. "LIBNAME SAVE SAS.WORK;") ?

Answer

Tom picture Tom · Jun 26, 2015

The define a libref use the LIBNAME statement. To find the path used by an existing libref use the PATHNAME() function.

libname save %sysfunc(quote(%sysfunc(pathname(work)))) ;

Be careful using this trick because SAVE.memname and WORK.memname will now refer to the same physical file. Code that worked in your development environment might not work because of name conflicts.