Managing Libraries

About Libraries

Libraries are collections of files that are stored on a server and accessed from SAS Enterprise Guide. Libraries give SAS Enterprise Guide users convenient access to their data on servers. When you add a metadata definition for a library through SAS Enterprise Guide Explorer or SAS Management Console, you make the metadata definition available to all the network SAS Enterprise Guide installations that have access to a specific metadata repository as well as all other applications that use the repository. The metadata definition for a library includes the path, engine, and other options for the library. The metadata definition corresponds to the information that is specified in a LIBNAME statement.
Table definitions specify the tables and columns that are available within a library. You can create table definitions by using one of the following functions:
  • using the Update Library Metadata function in SAS Enterprise Guide
  • using the Register Tables function in SAS Management Console
  • running the METALIB procedure in a SAS session (which synchronizes metadata with the physical contents of a library)
  • using SAS Data Integration Studio to build a data warehouse
You can include authorization settings for both library and table definitions, specifying which libraries and tables a user can access and whether the user can change the contents of a library.
Note: Before you add a library, you must use SAS Management Console to add the server on which the library resides.
To define a library:
  1. Define the library's path on the server platform.
  2. Specify the SAS engine that is identified with the library.
  3. Enter any associated options that you can specify in a LIBNAME statement. LIBNAME options work like the commands in an AUTOEXEC.BAT file. The LIBNAME options are stored on the client and then executed when a SAS Enterprise Guide application connects to the specified SAS server. For more information about SAS libraries, LIBNAME statements, and LIBNAME options, see SAS Language Reference: Dictionary.

Understanding the Metadata LIBNAME Engine

To understand how SAS Enterprise Guide assigns and accesses libraries, it is helpful to understand the metadata LIBNAME engine. The engine, also called the META engine, enables you to use a LIBNAME statement to reference a metadata definition for a library, rather than specifying the physical location of the library's tables. By default, the META engine provides read-only access to a library, which prevents the library contents from being different from the library metadata.
If you use the METAOUT=DATA option in the LIBNAME statement, the META engine can access tables that are not defined in metadata but that exist in the physical library. This option enables you to add and modify tables in the library. However, any metadata authorization settings that have been applied to tables or columns in the library are enforced. If a SAS program changes the contents of a library that uses the METAOUT=DATA option, you must synchronize the physical data and the metadata. To synchronize the data, you can use the Register Tables function in SAS Management Console, the METALIB procedure, or the Update Library Metadata task in SAS Enterprise Guide.

Adding a Library

To add a library, select Filethen selectNewthen selectLibrary and follow the prompts on each page of the Library Wizard. Depending on the options that you select in the wizard, the number of pages in the wizard and the page on which a specific option appears might change.
Use the following information when completing the wizard:
  • On page 1 of the wizard, you must specify a name for the library. The name can be up to eight characters long and must not be duplicated on any server on which you are creating the library. The wizard automatically enters the name in uppercase characters.
  • On page 2 of the wizard, you must specify how the library is assigned. You must choose to assign the library by using one of the following:
    SAS Enterprise Guide
    specifies that SAS Enterprise Guide uses the metadata that is supplied in the wizard to assign the library by using the native engine. No table or column metadata is used.
    SAS Server
    specifies that the library is assigned in an autoexec statement or through the METAAUTOINIT system option. SAS Enterprise Guide does not use the metadata that you specify for the library, but assumes that the library is already assigned.
    Metadata LIBNAME Engine
    specifies that SAS Enterprise Guide assigns the library by using the META engine.
    If Show only tables with metadata definitions is checked, then only tables that have metadata definitions appear when the library is selected. When this option is selected, the library is always read-only. This option is equivalent to the default behavior of the META engine. If the library is assigned using the metadata LIBNAME engine and this option is selected, it is equivalent to the METAOUT=ALL option.
    If the check box is not selected, then all tables in the library will appear (even if you deny ReadMetadata permission for a table or the table is not registered in the metadata repository). Permissions are enforced if a user tries to open a restricted table. In this mode, the library is not read-only. This option is equivalent to the METAOUT=DATA option.
    If you select the Allow tables to be created and deleted check box, then you can read, update, create, and delete tables. You can also insert records, create columns, and change column properties in tables. A newly created table must be registered in metadata before it can be read.
  • On page 4 of the wizard, you must specify the engine type for the library (file system, database system, or WebDAV) and specific information for the engine type that you select. If you are defining a file system or database system library, you must choose an engine. Select the SAS engine with which the data was created. For more information about engines, see the SAS documentation for your operating environment. See also the chapter that corresponds to your database management system in SAS/ACCESS for Relational Databases: Reference.
  • Also on page 4 of the wizard, you might have to specify the physical path where the library resides on the server. Depending on the value of the Engine Type field, Path might not be present. You can use the following wildcards in the Path field:
    <userid>
    substitutes a Windows user ID. For example, if a user logs on as ebeacon, then \\librarypath\<userid> becomes \\librarypath\ebeacon.
    <sample>
    substitutes the SAS Enterprise Guide sample directory. For example, if you installed using the default directories, <sample>\data becomes C:\Program Files\SAS\Enterprise Guide 3.0\Sample\data. If, however, another user installed in D:\EC, then <sample>\data becomes D:\EC\Sample\data.
    <serveruser>
    substitutes the server logon user ID.
    <serverpassword>
    substitutes the server logon password.
    <libraryuser>
    substitutes the library logon user ID.
    <librarypassword>
    substitutes the library logon password.
    Note: These wildcards might not work with client applications other than SAS Enterprise Guide and the SAS Add-In for Microsoft Office.
  • On page 5 of the wizard, you can specify library options and values. If wildcards are valid in the Path field, then you can also use them in the Options field. Avoid using prompting options such as DBPROMPT=YES. For additional options, see the chapter that corresponds to your database management system in SAS/ACCESS for Relational Databases: Reference.
  • On page 6 of the wizard, you must select the folder to which the library belongs. If you do not select a folder, the library is automatically stored in the Shared Data folder.
  • Page 7 of the server lets you test the library definition on each server. If the library name or libref is not unique on all servers, the conflict is listed in the Status column.
After you complete the wizard, the library is created and then displayed in the viewer under the client libraries for the specified servers.

Creating an Output Library

By default, SAS Enterprise Guide stores output data in the Sasuser, Work, or Egtask library, or a user-created output library on the SAS server. You can select Toolsthen selectOptionsthen selectOutput Library to change the default output library. For example, you might want all output to go to a central library that all users can access. In addition, Sasuser is a temporary location on z/OS and some UNIX systems, so output needs to be directed to a different location in order to be saved permanently.
To define an output library, you can follow either one of these strategies:
  • Use SAS Management Console to define the library. Select Data Library Manager, and then select New Library. Choose Pre-assigned Library as the library type to ensure that the library is assigned whenever the server starts. Make sure that the library is defined on all servers that will be used with SAS Enterprise Guide.
  • Use SAS Management Console to add the LIBNAME statement for the library to all server definitions that are used by SAS Enterprise Guide. Include the statement in the SAS startup statements field in the New Server wizard (for new servers) or in the Properties window (for servers that have already been defined).

Assigning Libraries

When you view a SAS server in SAS Enterprise Guide or SAS Enterprise Guide Explorer, you see a list of libraries on the selected server. The list includes both libraries that are assigned (identified with a yellow icon) and libraries that are unassigned (identified with a white icon).
identifying an unassigned library
Assigned libraries are libraries that are pre-assigned or assigned in an autoexec program. Unassigned libraries are libraries that have been defined in metadata but have not yet been assigned or accessed. To assign an unassigned library, right-click on the library and select Assign from the menu. If the library definition was created by SAS Enterprise Guide Explorer, the library is assigned using the method that was specified in the library definition. Otherwise, the library is assigned using the META engine in its default mode, which means that the library is read-only. The library contents also match the metadata definition (so physical tables that are not defined in metadata are not displayed), and the tables and columns that are accessible depend on the authorization settings.

Updating Library Properties

Properties for libraries include information such as names, pathnames, and LIBNAME options. To view or update this information:
  1. Select a server, and then locate the library whose properties you want to change.
  2. Select the library, and then select Properties from the pop-up menu.
  3. Select the item in the selection pane that corresponds to the information that you want to update. For information about each field, see Adding a Library .

Reset a Library Login

When you are prompted for credentials when connecting to a library, those credentials are stored in metadata so they can be used later. The Reset login option clears these credentials, so you are prompted for credentials the next time you connect to the library.
Note: You cannot use this option on libraries that have been assigned using the metadata LIBNAME engine (MLE).
To reset the login for a library, right-click on the library name and select Reset login.