METADATA Procedure |
Introduction to the Input XML String |
The IN= argument of PROC METADATA submits an XML-formatted method call 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 class
the Status method in the IServer class.
The methods are documented with many usage examples in SAS Open Metadata Interface: Reference. 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 for help in understanding concepts such as flags, filters, and templates. The following topics provide a brief introduction to the usage with PROC METADATA.
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 Status. The request starts and ends with Status tags. Do not include the DoRequest method in the XML string, because the procedure calls DoRequest for you.
proc metadata in='<Status> <Metadata> </Metadata> </Status>'; run;
A Method's Parameter Is an XML Element |
A method's parameters are represented as XML elements, which are nested within the method's XML element. In the following example, the <Metadata> element represents the Status method's InMetadata= parameter. You always use a <Metadata> element to represent an inMetadata= or inMeta= parameter.
proc metadata in='<Status> <Metadata> <OMA JournalSpaceAvailable="" /> </Metadata> </Status>'; run;
When you read the documentation about the Status method in SAS Open Metadata Interface: Reference, you learn that the inMetadata= parameter can submit an XML string itself. The XML string is represented as XML elements that are nested within the <Metadata> element.
With the Status method, if nothing is submitted within the <Metadata> element, the metadata server returns the default status information. In the previous example, however, an XML string is submitted. The string is an <OMA> element. The documentation for the Status method states that the <OMA> element requests the value for a specified attribute. In this example, the requested attribute is JournalSpaceAvailable. The metadata server returns the information to the SAS log:
<Status><Metadata><OMA JournalSpaceAvailable="200000000"/></Metadata></Status>
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 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, a PhysicalTable object has a Columns association to a Column object:
<PhysicalTable> <Columns> <Column/> <Columns> </PhysicalTable>
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: <Column/> .
See Also |
Forming proper XML input can be a challenge. Use the following resources:
See Examples: METADATA Procedure and Example: Creating a Report with the METADATA Procedure and the XML Engine.
SAS Open Metadata Interface: Reference provides the following information:
which methods to use for common tasks
the DoRequest method and other methods in the IOMI class
the Status method in the IServer class
SAS Metadata Model: Reference shows the relationships among objects, associations, and attributes that you specify in XML tags.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.