METALIB Procedure

Concepts: METALIB Procedure

How PROC METALIB Works

The procedure examines the data source (the SAS library) that is referenced by the SASLibrary object. Then, the procedure examines the SAS table names in the data source, and compares them to the values of the SASTableName= attributes in the metadata. For each SAS table name in the data source, the procedure checks the repository association list to see whether a matching table definition exists.
  • If a matching table definition does not exist, one is created.
  • If a matching table definition exists, it is updated to match the table definition in the data source.
  • If duplicate table definitions exist, only the first table definition is updated. The additional table definitions are ignored by default. If you specify UPDATE_RULE=(DELETE), the additional table definitions are deleted. If you specify UPDATE_RULE=(DELETE NODELDUP), the additional table definitions are not deleted.
  • If a table definition exists that does not correspond to a table in the data source, it is ignored by default. If you specify UPDATE_RULE=(DELETE), the table definition is deleted.
  • If a column name in a table definition matches a column name in the data source, but it is in a different case (for example, lowercase instead of uppercase), then the following change occurs in the table definition. If the data source is a SAS table or view, the column name in metadata is updated to match the case of the column name in the data source. If the data source is a DBMS, the column name in metadata is deleted and added to match the case of the column name in the data source. If the DBMS has column mappings in a SAS Data Integration Studio job, you might have to recreate the column mappings.
  • When it creates metadata, PROC METALIB creates column attributes in the metadata to match the data. It does not use the DBSASTYPE data set option settings. You can manually adjust a column's attributes in the metadata, and the metadata LIBNAME engine will use the modified settings. To do this, you must manually adjust a column’s attributes in the metadata after each run of the METALIB procedure or you must exclude tables that use the DBSASTYPE data set option.
For more information, see topics about managing table metadata in the SAS Intelligence Platform: Data Administration Guide.

What Metadata Is Updated?

The procedure updates all table definitions that are associated with the specified SASLibrary object. The affected metadata objects include PhysicalTable, Column, Index, PrimaryKey, ForeignKey, UniqueKey, and KeyAssociation, with the following exceptions:
  • PROC METALIB does not create UniqueKey objects for data in Oracle.
  • PROC METALIB does not create Index, PrimaryKey, and ForeignKey objects for external databases that are accessed with the SAS/SHARE server.
  • PROC METALIB does not create metadata for indexes on which expressions are defined. When an expression is defined on an index, the index is ignored. Table metadata is created without metadata for the index.
Note: The maximum length for index names that can be registered by PROC METALIB is 256 characters. However, other components of SAS or the DBMS might enforce a shorter length, causing the name to be truncated.
For more information about these metadata objects, see their descriptions in SAS Metadata Model: Reference.