BookmarkSubscribeRSS Feed

Admin Notebook: Using the New Library Wizard’s Generic Library Template

Started ‎07-10-2018 by
Modified ‎07-11-2018 by
Views 2,004

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.

 

Background References

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.

 

Metadata Libraries:

LIBNAME statement:

New Library Wizard:

  • Use the Help feature in either SAS Data Integration Studio or SAS Management Console, Data Library Manager to read more about the New Library Wizard.

 

General Steps for Using the Generic Library Template

These are the general steps for using the Generic Library template to make a new metadata library:

 

  1. Write (and test!) the LIBNAME statement to access the data.
  2. Create the new Metadata library by completing the Generic Library template using the information from the LIBNAME statement.
  3. Verify that the newly created Metadata library will generate the correct LIBNAME statement.

The example below shows more details for each of these steps.

 

Creating a Library for Data Accessed Through the SAS PC Files Server

  1. Write (and test!) a LIBNAME statement to access the data.

    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:

     

    Libref

    shoes

    Engine

    PCFILES

    All other specification

    PATH='C:\ClassData\MSAccessData\orion_shoes.accdb' ACCESS=readonly

     

  2. Create the new Metadata library by completing the Generic Library template using the information from the LIBNAME statement.

     

    1. Start the New Library Wizard. For this example, I’m starting the Wizard from the Data Library Manager in SAS Management Console.

       

      GenericLibrary001.png

       

    2. Select the Generic Library template.

       

       GenericLibrary002.png

       

    3. Step through the Wizard screens. On the first screen, name the library, add a description (optional), and select a metadata folder location to store the new library.

       

      GenericLibrary003.png

       

    4. Continue with the next screen and select the application server(s).

       

      GenericLibrary004.png

       

    5. The library properties screen is where you will need to refer the LIBNAME statement you wrote (and tested) earlier. Fill in the Libref and Engine fields. Put all other specification from the LIBNAME statement into the Other Options field.

       

      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.

       

      GenericLibrary005.png

       

      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.

       

    6. Finish the wizard to create the new library.
  3. Verify that the newly created Metadata library will generate the correct LIBNAME statement.

    From Data Library Manager right click on the newly created library and select Display LIBNAME Statement.

     

    GenericLibrary006.png

     

    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.

     

    GenericLibrary007.png

     

    The new metadata library should work correctly to access the data through the PC Files Server.

 

Final Thoughts

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.

Version history
Last update:
‎07-11-2018 09:09 AM
Updated by:

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags