- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I'd like to automatically assign libraries from metadata with a code snippet. Retrieving the info including libname and physical location is the easy part, so I had though I could just write a libname statment and paste the correct info from metadata with macro variables. However, when I try this I get the following errors:
ERROR: Encountered error when the V9 engine tried to determine if MYLIB has a registered secured library object location. ERROR: User does not have appropriate authorization level for library MYLIB. ERROR: Error in the LIBNAME statement. ERROR: Libref MYLIB is not assigned.
So it seems I'm not allowed to assign libraries that already sit as unassigned in the metadata. Assigning them manually in EG from the server menu works fine, so this is not an actual authorization problem.
Is there any way to get around this? Maybe there's a piece of metadata code to assign a library from metadata?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The libname meta engine allows you to assign a library that uses a libname definition from SAS Metadata.
Here a sample as used in an actual implementation:
libname pg_temp meta liburi="SASLibrary?@libref='pg_temp'" metaout=data;
SASLibrary?@libref='pg_temp'"
searches through metadata library object and will use the one where the libref property has the value pg_temp.
In below sample the libref that gets assigned libname pg_temp
will have the same libref like the one defined in SAS metadata @libref='pg_temp'"
that gets used to define the library. This gives you a result pretty much the same as if the library would have been defined as pre-assigned in SAS metadata.
Now.... metadata bound libraries are something special and I'm not sure if above syntax will also work for them. But it's your best shot so just try it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It would be useful to share the code that generated this error...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What happens if you try the meta libname engine?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @paul_e
I would highly encourage you to read the following papers and article, if you have not already
- A Framework for Using the SAS® Metadata Server from SAS® Foundation
- A Programming Approach to Implementing SAS® Metadata-Bound Libraries for SAS® Data Set Encryption
- A Metadata to Physical Table Comparison Tool
- SAS administrator tip: How to identify and prevent duplicate librefs in SAS metadata
These may not provide you straight answer to you issue, but I hope they will provide you with wider perspective on what's involved with libraries defined in the Metadata Server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The libname meta engine allows you to assign a library that uses a libname definition from SAS Metadata.
Here a sample as used in an actual implementation:
libname pg_temp meta liburi="SASLibrary?@libref='pg_temp'" metaout=data;
SASLibrary?@libref='pg_temp'"
searches through metadata library object and will use the one where the libref property has the value pg_temp.
In below sample the libref that gets assigned libname pg_temp
will have the same libref like the one defined in SAS metadata @libref='pg_temp'"
that gets used to define the library. This gives you a result pretty much the same as if the library would have been defined as pre-assigned in SAS metadata.
Now.... metadata bound libraries are something special and I'm not sure if above syntax will also work for them. But it's your best shot so just try it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content