BookmarkSubscribeRSS Feed
sakurugoda
Fluorite | Level 6

Due to a requirement in creating multiple SAS libraries from time to time in the Management Console, I am trying to figure out how to do this programmatically.  These libraries are pointing to external databases. So far, using the available examples I was able to use the following code to create library metadata. SAS Version 9.4M6.

 

proc metadata in='<AddMetadata>
 <Metadata>
   <SASLibrary
      Name="Test Library" 
      Desc="This is a test" 
      Folder="\Shared Data\Test"
      Engine="DB2"    
      IsDBMSLibname="1"      
      IsHidden="0"
      Libref="testlib"
      IsPreassigned="0"
      PublicType="Library">
    </SASLibrary>
 </Metadata>
 <Reposid>A0000001.A849HGWS</Reposid>
 <NS>SAS</NS>
 <Flags>268435456</Flags>
 <Options/>
</AddMetadata>
';


However this is still missing the resource template, schema name, location (folder name). Is there any way we can add these programmatically as well? Also anyway to update the access templates? Any attributes that I can assign these values to when calling proc metadata? Thanks in advance.

1 REPLY 1
AllanBowe
Barite | Level 11
This macro will create a BASE engine library - I'm sure it could be extended to support other engine types: https://core.sasjs.io/mm__createlibrary_8sas.html

If you manage it, feel free to raise a PR!

By the way we also have a free metadata exploration tool, if you'd like a copy just send a PM.
/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 356 views
  • 0 likes
  • 2 in conversation