METADATA Procedure

Concepts: METADATA Procedure

Introduction to the METHOD= Argument

New in SAS 9.3, the METHOD= argument enables PROC METADATA to submit two types of SAS Open Metadata Interface methods calls to the SAS Metadata Server.
  • When METHOD=DOREQUEST (or when the METHOD= argument is omitted from the PROC METADATA request), the procedure issues an IOMI DoRequest method call. It accepts as input another SAS Open Metadata Interface method call that is formatted for the IOMI DoRequest method. The IOMI DoRequest method is a messaging interface for SAS Open Metadata Interface methods. It accepts all methods from the IOMI server interface, which consists of methods for reading and writing metadata. It also accepts the IServer Status method, which supports options for monitoring the server and its configuration. METHOD=DOREQUEST is legacy behavior.
  • When METHOD=STATUS, the procedure issues an IServer Status method call. It accepts as input an XML element that is valid in the inMeta parameter of the IServer Status method. The IServer Status method supports XML elements that return information about the SAS Metadata Server, including its current status, the values of server configuration and backup configuration options, and journal statistics. For a comprehensive list of inMeta XML elements, see Status documentation in the SAS Open Metadata Interface: Reference and Usage.
Use METHOD=STATUS to get SAS Metadata Server status information if the server is paused. The DoRequest interface is not available when the server is paused.
For examples of how METHOD=STATUS is used, see the following:

Formatting an XML Method Call for DoRequest

The IN= argument of PROC METADATA submits one or more XML-formatted method calls to the metadata server. You can submit any method that is supported by the DoRequest method of the SAS Open Metadata Interface, including:
  • all methods in the IOMI server interface
  • the IServer Status method
When multiple method calls are sent in one DoRequest submission, they must be enclosed within <Multiple_Requests></Multiple_Requests> elements.
For information about how to format a method call for DoRequest, see the documentation for the DoRequest method in SAS Open Metadata Interface: Reference and Usage. The IOMI server interface section of the book shows how to format each IOMI method for use in the DoRequest interface. The IOMI methods are documented with many usage examples in SAS Open Metadata Interface: Reference and Usage.
PROC METADATA is among several clients that can submit the DoRequest method to the metadata server. You are strongly advised to read SAS Open Metadata Interface: Reference and Usage for help in understanding concepts such as flags, filters, and templates. The following topics provide a brief introduction to submitting method calls through the DoRequest interface.

The Entire Method Is an XML Element

With PROC METADATA, you submit a request as an XML string. In the request, a method is represented as an XML element. In the following example, the method is GetMetadataObjects. The request starts and ends with GetMetadataObjects tags. Do not include the DoRequest method in the XML string, because the procedure calls DoRequest for you.
proc metadata
   in='<GetMetadataObjects>
	<Reposid>A0000001.A5UO0N94</Reposid>
         <Type>SASLibrary</Type>
         <Objects/>
         <NS>SAS</NS>
         <Flags>0</Flags>
         <Options/>
       </GetMetadataObjects>';
run;
The GetMetadataObjects method has parameters Reposid, Type, Objects, NS (namespace), Flags, and Options. The method parameters are submitted as XML subelements in the input XML method string.

A Metadata Object Is an XML Element

Some methods input metadata objects. Within your XML string, metadata objects are represented as XML elements. Object attributes, if any, are XML tag attributes. In the following code, a PhysicalTable object has "NE Sales" in its Name= attribute:
<PhysicalTable Id="A5UO0N94.B20000TV" Name="NE Sales"/>

A Metadata Association Is an XML Element

Metadata associations are XML elements, which are nested within the primary object's XML element. In the following code, the PhysicalTable object has a Columns association to a Column object that has “Sales Associates” in its Name= attribute:
<PhysicalTable Name="NE Sales">
  <Columns>
   <Column Name="Sales Associates"/>
  </Columns>
</PhysicalTable>
The Name= attribute in the Column XML element defines or identifies a particular Column metadata object.
Empty XML elements (that is, XML elements with no content between start and end tags) can be expressed in XML shorthand as a singleton tag, like this: <Columns/>. In a GetMetadata request, an empty association name subelement instructs the metadata server to return all objects associated to the primary object under that association name.

Quotation Requirements

Single or double quotation marks can be used to submit the IN= XML method string. To ensure that the string is parsed correctly, it is recommended that any additional quotations within the string, such as those enclosing XML attribute values in the metadata property string, be balanced. For example, if you submit the IN= string within single quotation marks, use double quotation marks for attribute values. If you use double quotation marks to submit the IN= string, use single quotation marks for attribute values.
When additional nesting of quotations is necessary, such as in a GetMetadataObjects <XMLSELECT search="string"/> element, use double apostrophes or double double quotation marks as follows:
<XMLSelect search="*[@PublicType=''InformationMap.Relational'']"/>
<XMLSelect search=""*[@PublicType= 'InformationMap.Relational']""/>

Submitting an XML Element with METHOD=STATUS

When METHOD=STATUS, there is no need to specify all of the Status method’s parameters in the IN= XML string. PROC METADATA accepts as input XML elements that are valid in the Status method’s inMeta parameter. In the IN= argument, specify only the XML elements for which you want to get values.
proc metadata
   method=status
   in='<ServerState/>
		<PauseComment/>
		<OMA JournalState=""/>
		<OMA JournalHistoricalData=""/>';
 run;
This example submits four requests that might be useful when the server is unavailable. For more information about the Status method’s XML elements, see the Status method documentation in SAS Open Metadata Interface: Reference and Usage.

See Also

Forming proper XML input can be a challenge. Use the following resources:
  • SAS Open Metadata Interface: Reference and Usage provides the following information:
    • which methods to use for common tasks
    • the DoRequest method and other methods in the IOMI server interface
    • the Status method in the IServer server interface
  • The SAS Metadata Model: Reference shows the relationships among objects, associations, and attributes that you specify in XML tags.