METADATA Procedure

Example 1: Get Information about Metadata Repositories

Features:

metadata server connection system options

XML string in IN= argument

default output

fileref in OUT= argument

output displayed in a browser

Note: You must be an administrative user of the metadata server to perform this task.
This example issues the IOMI GetRepositories method to list the metadata repositories registered on the SAS Metadata Server. By default, the GetRepositories method gets the values of the Id, Name, Desc, and DefaultNS (namespace) attributes. This example sets the OMI_ALL (1) flag to return the values of the RepositoryType, RepositoryFormat, Access, CurrentAccess, PauseState, and Path attributes.
A request like this is useful for getting repository IDs and for getting a quick idea of repository availability. A repository’s persisted access mode is indicated in the Access attribute. Its active state is indicated in the PauseState attribute. If the value in PauseState differs from the value in Access (and PauseState is not blank), then the repository is being affected by a metadata server pause.
The Access attribute returns the following values to indicate a repository’s availability:
OMS_ADMIN
indicates the repository is registered for administrative access only.
OMS_FULL
indicates a registered access mode of full access.
OMS_READONLY
indicates a registered access mode of Read-Only access.
OMS_OFFLINE
indicates the repository is intentionally unavailable to all users.
GetRepositories request with default output.
options metaserver="myserver"
        metaport=8561
        metauser="sasadm@saspw"
        metapass="adminpw";

proc metadata 
		in="<GetRepositories>       
			<Repositories/> 
			<!-- OMI_ALL (1) flag -->   
			<Flags>1</Flags>       
			<Options/> 
			</GetRepositories>";

run;
The XML output is written to the SAS log as follows. The output is a continuous, unformatted string. To improve readability, you can assign a fileref, specify the OUT= argument to write the output to an XML file, and open the file in a browser.
NOTE: Response XML:

<GetRepositories><Repositories><Repository Id="A0000001.A0000001" Name=
"REPOSMGR" Desc="The Repository Manager" DefaultNS="REPOS" RepositoryType="" 
RepositoryFormat="12" Access="OMS_FULL" CurrentAccess="OMS_FULL" PauseState="" 
Path="rposmgr"/><Repository Id="A0000001.A5JTOPDN" Name="Foundation" Desc="" 
DefaultNS="SAS" RepositoryType="FOUNDATION" RepositoryFormat="12" Access="OMS_FULL"
CurrentAccess="OMS_FULL" PauseState="" Path="MetadataRepositories/Foundation"/>
<Repository Id="A0000001.A521IKPO" Name="Custom1" Desc="" DefaultNS="SAS" 
RepositoryType="CUSTOM" RepositoryFormat="12" Access="OMS_FULL" CurrentAccess=
"OMS_FULL" PauseState="" Path="MetadataRepositories/Custom1"/><Repository 
Id="A0000001.A5LSUZGP" Name="Custom2" Desc="" DefaultNS="SAS" RepositoryType=
"CUSTOM" RepositoryFormat="12" Access="OMS_READONLY" CurrentAccess="OMS_READONLY"
PauseState="READONLY" Path="MetadataRepositories/Custom2"/><Repository 
Id="A0000001.A5EXCXUI" Name="Custom3" Desc="" DefaultNS="SAS" RepositoryType=
"CUSTOM" RepositoryFormat="12" Access="OMS_ADMIN" CurrentAccess="OMS_ADMIN" 
PauseState="ADMIN" Path="MetadataRepositories/Custom3"/></Repositories>
<Flags>1</Flags><Options/></GetRepositories>

GetRepositories request that directs output to an XML file.For more information about using filerefs, see Filerefs with the IN= and OUT= Arguments.
filename myoutput "C:\myxml\reports\getrepos.xml";

proc metadata 
out=myoutput
in="<GetRepositories>       
  <Repositories/> 
  <!-- OMI_ALL (1) flag -->   
  <Flags>1</Flags>       
  <Options/> 
</GetRepositories>";

run;
This is what the XML output looks like in a browser:
The way XML output looks in a browser