The New Library Wizard does its job beautifully. As a SAS administrator, I appreciate how the wizard makes creating metadata libraries easy. I start the wizard, pick a template for the data source, fill in a few screens of information, click Finish and Voilà! One newly defined metadata library.
But occasionally I need to create a library for a data source that does not have a template – and that is where the Generic Library template shines. Basically, if I can write a LIBNAME statement to access the data, the Generic Library template will let me create a metadata library to access the data.
Keep reading to see the steps for using the Generic Library template and an example creating a library for data accessed through the SAS PC Files Server. The example steps can easily be adapted to other data sources.
If you are not familiar with Metadata libraries, the LIBNAME statement, or using the New Library Wizard from either SAS Management Console or from SAS Data Integration Studio, use the references below to get a quick overview.
New Library Wizard:
These are the general steps for using the Generic Library template to make a new metadata library:
The example below shows more details for each of these steps.
For this example, the data for the library is in a Microsoft Access database file that is being accessed using the SAS PC Files Server. The file is located at 'C:\ClassData\MSAccessData\orion_shoes.accdb' on the workspace server machine and we want to limit access to read-only. The following LIBNAME statement will access the data correctly:
LIBNAME shoes PCFILES PATH='C:\ClassData\MSAccessData\orion_shoes.accdb' ACCESS=readonly;
Before starting the New Library wizard, you should identify the libref and engine from the LIBNAME statement. Also note all the other specifications after the engine name. For this example, you would identify:
All other specification
Keep in mind that there is no error checking in the Other Options field, so it is important to test the LIBNAME statement before proceeding to creating the metadata library.
Note: If the LIBNAME statement referred to a physical directory without using the PATH= keyword, you could place the directory name in the Path Specification, Selected Items field. Since our LIBNAME statement was referring to a file instead of a directory, it needed the PATH= keyword and therefore was placed in the Other Options field.
From Data Library Manager right click on the newly created library and select Display LIBNAME Statement.
The output should match your original LIBNAME statement (options may appear in a different order). For this example, you can see that the generated LIBNAME statement matches the original LIBNAME statement.
The new metadata library should work correctly to access the data through the PC Files Server.
Hopefully you now have an idea of how to use the Generic Library template to create metadata libraries. Basically, if you can write the LIBNAME statement for a data source, you should be able to use the New Library wizard and the Generic Library template to define a metadata library to access the same data.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.