Two methods for editing SAS metadata

The SAS Metadata Server holds all of the metadata for a given SAS EBI installation.

For most SAS administrators, the sole view into the Metadata Server is through SAS Management Console. This is a very limited perspective out of the box, as much of the metadata is not surfaced by default in the Management Console.

For most SAS programmers, the view into the Metadata Server is through tools such as Data Integration Studio or Enterprise Guide. These BI tools are useful, but like SAS Management Console, they come with limitations in surfacing the entirety of the metadata.

Seasoned SAS programmers may also have experience interacting with the Metadata Server using programming commands such as METABROWSE and METAFIND.

In fact, there is a METABROWSE and METAFIND tool built into Foundation SAS. METABROWSE and METAFIND are the key to a deeper review of the metadata, but they do not offer edit or delete functions that may be needed by SAS administrators in managing metadata.

Problem: Finding and editing deeply-nested metadata

Recently a FQDN change within a client domain was ordered that directly impacted the EBI environment I manage and administer. SAS 9.2 (latest releases only) and SAS 9.3 come bundled with a handy host renaming tool for situations just like these. However, the client was working under an earlier version of SAS 9.2, so the tool was not available and a manual update of the hostname was required across all SAS servers and throughout the SAS Metadata Server.

Can this tedious task be accomplished? Only if you have the SAS EBI Metadata Utility or you enable editing with the METABROWSE tool in Foundation SAS!

Dozens of hard-coded hostname references are located in easily edited, flat configuration (mostly .xml, .config, and .ini) files on the server, and others are located directly in metadata that is easy to view and update using nodes and trees within the SAS Management Console standard plug-ins. However, many other hostname references are buried in metadata field properties that don't surface by default in the Console.

Important:If you don't find and update all hostname references, the SAS applications (particularly the web applications) are subject to failure. Either they don't start, or they start but crash with errors.

In this post, I want to introduce you to metadata editing using the METABROWSE and METAFIND tools within Foundation SAS as well as the Metadata Utility within SAS Management Console.

It can be difficult and tedious to locate objects (and their attributes) that are three or four levels deep in the metadata trees using the Metadata Utility because you must query by ID. For this reason, if you’ve a lot of metadata to update (especially when you’re not sure exactly where the object may be located), it’s better to use the METABROWSE tool within Foundation SAS if you have access.

Method One: Using the METABROWSE tool within Foundation SAS to identify and edit metadata.

Note: METABROWSE can be executed with BASE SAS programming, but since I'm addressing SAS administrators, I'll focus on using the built-in METABROWSE tool within SAS Foundation.

Open a session of Foundation SAS.

Open the METABROWSE tool (Solutions→Accessories→Metadata Browser). You will be prompted for your SAS credentials.

The Metadata Browser window will display a metadata tree and attributes.

Once you are successfully logged into the METABROWSE tool, open the Explorer tool to enable EDIT mode (Tools→Options→Explorer).
Note: You must have the METABROWSE tool window open to do this.

Enable browsing in EDIT mode by unchecking the radio box on the General tab of the Explorer labeled ‘Metadata Browse Mode’.

Switch back to the METABROWSE tool window. You can now select fields for editing. For example, you can expand the ServerComponent Tree, browse through the various SAS Server Components and change their properties, including hostname.

Method Two: Using the Metadata Utility within SAS Management Console to identify and edit metadata.

By default, the Metadata Utility in SAS 9.2 is disabled. You must move the omitoolsmc dir up from the SAS Management Console plugins advanced folder in your installed directory on the file system (Note:Typically at Program Files/SAS/SAS Management Console/SAS_version#/plugins/advanced) to the SAS Management Console plugins folder and restart SAS Management Console to enable the Metadata Utility.

Open the Metadata Utility (Tools→XML Metadata Interface).

The top of the Metadata Utility is comprised of radio checkboxes and dropdown selectors that are used to narrow the scope of your browsing or enable special options. The bottom of the Metadata Utility has an XML input field used to enter search or update strings and an output field that displays the results of your search, update, or delete action.Once the Metadata Utility is open, click on the Get Metadata Objects tab. To edit or delete metadata for a metadata object, you must must know the metadata ID associated with the object. (You can skip this step if you’ve obtained the metadata ID through other means).
For our example, we will edit a hostname associated with a Server Component object. Select ServerComponent from the object type dropdown and click on the Execute button.

A list of all Server Component objects registered in the Metadata Server is displayed along with their IDs. Select and copy the entire line that references the server Component object you wish to query for editing (including the <>, signs).

Paste the XML line into the Input XML: box. Clear the Output XML: box using the Clear button on the right side of the Output XML:box. Switch to the Get Metadata tab and click the Execute button. Detailed property results are displayed in the Output XML: box for this object. The attributes of the object are displayed in the Output XML: box. One of these properties is the machine Id and hostname (labeled Name in our graphic and redacted for security).

Clear the contents of the Input XML: box using the Clear button on the right side of the Input XML: box. Select, copy, and paste the entirety of the Output XML: box contents into the Input XML:box. Note:If you fail to copy part of the attribute list, the object can become irreversibly corrupted within the Metadata Server. Carefully edit the attribute lines you wish to update.

Switch to the Update Metadata tab and click on the Execute button. The updated metadata should appear in the Output XML: box. It should match the Input XML: box exactly.

For further verification, you can switch back to the Get Metadata tab and perform another query for the Server Component object you just edited, checking the Output XML: box for the correct values.

In SAS 9.2, the SAS Deployment Manager can also be used to correct an issue cause by a change in the FQDN. Read an Overview of Updating Host Name References for more information on this topic.

Two methods for editing SAS metadata was published on SAS Users.