10-24-2013 03:16 AM
In SAS 9.3 Management console I've defined a BASE SAS library (not preassigned) with a macro variable in the pathname: path=&dataroot\dir1\datamap.
Now I would like to open this library is SAS EG. I see the library in my list of libraries but when I open the library I get an error message:
[Error] Library TESTBEH does not exist.
If I change the path of the library to the physical location that the macro refers to then it works fine.
Does anyone know what the problem is and how it can be solved?
Thanks in advance.
10-24-2013 04:34 AM
you can define this macro/libpath in your autoexec file or you can define this macro as your automatic macro variable so that every time you will open EG session it will be available for you .
10-24-2013 11:38 AM
I don't know about the Management console but generally to get the macro value to resolve as intended you want a period after the macro variable(s).
10-25-2013 05:40 AM
It's an interesting question and one I've already tried to resolve for myself. I never managed to define a library path in metadata using a macro variable.
I believe (only believe) one of the reasons is that the path gets quoted in single quotes and you don't have a choice to change this. Considering that windows path names can contain '&' putting the path in single quotes makes kind of sense to me.
The only not so elegant solution I could come up with so far is to define the library in metadata but then to overwrite the path in the autoexec. This of course will assign the library. I have no solution of how to do this with a not pre-assigned library and leave it as not pre-assigned.
10-29-2013 09:25 AM
Hello, I've cross-posted this to the SAS Macro Facility, Data Step and SAS Language Elements community in case anyone has input on this.