The METADATA procedure can be used to perform some of
the same informational tasks as the METAOPERATE procedure. The benefit
of using PROC METAOPERATE is simpler syntax. The benefit of using
PROC METADATA is a broader range of tasks. (PROC METADATA supports
all parameters of the methods that it submits. Some of these parameters
are not supported by PROC METAOPERATE.) In addition, PROC METADATA
creates XML output that you can use in another program (for example,
to run reports).
Here is
an example that uses PROC METAOPERATE to check whether the SAS Metadata
Server is paused or running:
proc metaoperate
action=status;
run;
The SAS Metadata Server returns the following information
to the SAS log:
NOTE: Server a123.us.company.com SAS Version is 9.02.02B0P012308.
NOTE: Server a123.us.company.com SAS Long Version is 99.02.02B0P01232008.
NOTE: Server a123.us.company.com Operating System is XP_PRO.
NOTE: Server a123.us.company.com Operating System Family is WIN.
NOTE: Server a123.us.company.com Operating System Version is Service Pack 2.
NOTE: Server a123.us.company.com Client is janedoe.
NOTE: Server a123.us.company.com Metadata Model is Version 11.02.
NOTE: Server a123.us.company.com is RUNNING on 11Aug08:15:54:15.
PROC METADATA can perform
a similar check with the following code:
proc metadata
in=' <Status>
<Metadata>
</Metadata>
</Status>';
run;
In SAS 9.3, you can
also use the following code (note the blank space in the IN= argument):
proc metadata
method=status
in=' ';
run;
The SAS Metadata Server
returns the following information to the SAS log in the form of XML.
The status parameters differ slightly from those returned by PROC
METAOPERATE.
<ModelVersion>12.04</ModelVersion><PlatformVersion>9.3.0.0</PlatformVersion>
<ServerState>ONLINE</ServerState><PauseComment/><ServerLocale>en_US</ServerLocale>
The legacy behavior
of PROC METADATA is to issue method calls through the SAS Open Metadata
Interface DoRequest method. The first PROC METADATA example formats
the Status method request for the DoRequest method. The DoRequest
method is not available when the SAS Metadata Server is paused. In
SAS 9.3, to enable clients to query a paused SAS Metadata Server for
status information, the METHOD= argument is implemented to issue Status
method requests directly to the server. The second PROC METADATA example
shows how METHOD=STATUS is used to get default status information.
PROC METADATA can submit
parameters that are not supported by PROC METAOPERATE. Here is an
example:
proc metadata
in=' <Status>
<Metadata>
<OMA JOURNALSTATE=""/>
</Metadata>
</Status> ';
run;
The code returns the
journal state:
<Status><Metadata><OMA JOURNALSTATE="IDLE"/></Metadata></Status>
Here is the same example
using METHOD=STATUS. (To get information with METHOD=STATUS, you
submit the parameter directly in the IN= argument.)
proc metadata
method=status
in='<OMA JOURNALSTATE=""/>';
run;
This code returns the
journal state:
<OMA JOURNALSTATE="IDLE"/>
If you have a simple
query that is not supported by PROC METAOPERATE, and you do not want
to assign an XML LIBNAME engine to parse the output of PROC METADATA,
you can use the metadata DATA step functions.
SAS provides the METADATA_PAUSED Function to determine
whether the SAS Metadata Server is paused. SAS provides the METADATA_VERSION Function to get the
model version number.