Hi,
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.
Regards,
Berry
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 .
Hi,
This macrovariable is already defined in an autoexec file and is available for my EG-session.
Regards,
Berry
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).
path=&dataroot.\dir1\datamap
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.
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.
Anna
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.