Does the Metadata Match the Physical Table?
It is easy enough to update the metadata to match the physical tables in a library, but it can often be preferable to simply check whether the metadata matches the physical tables, without actually altering anything. The METALIB procedure enables this to be done.
This example checks the library whose name is “Courses demo”. NB this is the name of library, not its LIBREF.
The EXCLUDE line here specifies three data sets that are not to be checked.
The REPORT and UPDATE_RULE lines together specify the kind of report to be generated. The values seen here are often used; for alternatives, please refer to the SAS Institute documentation. “UPDATE_RULE=(DELETE)” is less alarming than it sounds. Its basic meaning is that if no physical table were found corresponding to a table registered in metadata, then that table’s registration would be deleted.
However, this is countermanded by the next line, “NOEXEC”, which says “don’t actually do anything” – so the UPDATE_RULE only affects the nature of the report generated, and the metadata remains unaltered.
When this code is run, a window pops up requiring credentials for the metadata server to be entered. The report then produced has several sections:
- A summary similar to the following:
- For any row other than “Total tables analysed” that contains a non-zero value, a section of the report lists the tables involved.
- For “Tables to be Updated”, the individual differences found are listed, for example:
Here the physical table contains 4 columns whose names begin with “S” that are not currently registered in metadata, and does not contain 3 registered columns whose names begin with “H”. The “Change” column indicates what would have happened to the metadata for each of these columns, if NOEXEC had not been specified.