METADATA Procedure

Example 7: Request the Metadata for One Object

Features:

IN= argument

Other features:

<Flags> element

This code submits a GetMetadata method for a table whose object identifier is A58LN5R2.AR000001. The GetMetadata method retrieves the values of specified properties for a specified metadata object. The requested properties can be specified in the input property string or indicated by GetMetadata flags. GetMetadata supports the following flags in order to get information about an object:
OMI_ALL_SIMPLE (8)
gets all attributes of the specified object.
OMI_ALL (1)
gets all of the attributes and direct associations of the specified object.
OMI_FULL_OBJECT (2)
is new in SAS 9.3. Gets the requested values of the specified object, and the Id=, Name=, and Desc= attributes of all of the secondary objects in the specified object's logical metadata definition. The specified object must be a PrimaryType subtype in the SAS Metadata Model, and it must have a type definition in the type dictionary. For more information about the type dictionary, see Using Language Elements That Read and Write Metadata. OMI_FULL_OBJECT expands both an object’s direct and nested associations.
OMI_TEMPLATES (4)
gets the attributes and associations specified in one or more property strings submitted in a <TEMPLATES> XML element in the OPTIONS parameter of the GetMetadata method.
The flags can be set alone or in combination. If you want to return only information about properties that have values stored for them, include the OMI_SUCCINCT (2048) flag. To combine GetMetadata flags, add their numeric values together, and specify the total in the <Flags> parameter. For more information about the flags, see SAS Open Metadata Interface: Reference and Usage.
Request the full metadata definition of a table object.Metadata objects are identified to the GetMetadata method with their metadata type and Id= values. This example requests information about a PhysicalTable object, and sets the OMI_FULL_OBJECT (2) and OMI_SUCCINCT (2048) flags.
filename myoutput "C:\results1.xml" lrecl=256;

proc metadata
     in='<GetMetadata>
         <Metadata>
            <PhysicalTable Id="A5TJRDIT.B2000005"/>
         </Metadata>
         <Ns>SAS</Ns>
	<!-- OMI_FULL_OBJECT (2) + OMI_SUCCINCT (2048) -->
         <Flags>2050</Flags>
         <Options/>
         </GetMetadata>'
		  out=myoutput;
run;
A sample of the content of the results1.xml file, opened in a browser, follows:
Contents of the results1.xml File
Contents of results1.xml file, opened in a browser