BookmarkSubscribeRSS Feed
bheerschop
Obsidian | Level 7

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

5 REPLIES 5
pradeepalankar
Obsidian | Level 7

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 .

bheerschop
Obsidian | Level 7

Hi,

This macrovariable is already defined in an autoexec file and is available for my EG-session.

Regards,

Berry

ballardw
Super User

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

Patrick
Opal | Level 21

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.

AnnaBrown
Community Manager

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 Community Trivia
SAS Bowl XXIX, The SAS Hackathon
Wednesday, March 8, 2023, at 10 AM ET | #SASBowl

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 5 replies
  • 3825 views
  • 6 likes
  • 5 in conversation