| DATA Step Functions |
SAS provides a family of metadata DATA step functions to get attributes, associations, and properties from metadata objects. These functions also enable you to set and update attributes, associations, and properties for metadata objects.
For more information about the SAS Metadata Model, see Overview of SAS Namespace Submodels.
| Connection Information |
Before you can use the metadata DATA step functions, you must establish a connection with the SAS Metadata Server by using the SAS metadata system options. The METASERVER, METAPORT, METAUSER, and METAPASS options individually specify the metadata server connection properties for a given user. The METAPROTOCOL option sets the network protocol for communicating with the SAS Metadata Server and the METAREPOSITORY option specifies the name of the default repository to use on the SAS Metadata Server.
The following option statements set the metadata system options to connect to the SAS Metadata Server:
options metaserver="a123.us.company.com"
metaport=9999
metauser="metaid"
metapass="metapwd"
metaprotocol=bridge
metarepository="myrepos";
For more information about these system options, see SAS Metadata System Options.
| Referencing Metadata Objects in the DATA Step |
The SAS Open Metadata Architecture uses Uniform Resource Identifier (URI) formats to identify metadata objects. A URI is a generic set of all names and addresses, which are short strings that refer to objects.
When you reference a metadata object on the server, typically you use the generated ID for the metadata object. The object ID has the general form of "A3YBDKS4.AH000001".
When you use the SAS metadata DATA step functions, you must reference objects using one of the following URI formats:
Reference by ID only
omsobj: A3YBDKS4.AH000001
This format includes the unique instance identifier that is assigned to the metadata object. This format is the least efficient metadata resource reference.
Reference by type and id
omsobj: LogicalServer/A3YBDKS4.AH000001
This format includes the metadata object type and the unique instance identifier that is assigned to the metadata object. This format is the most efficient metadata resource reference.
Reference by type and search parameters
omsobj: LogicalServer?@Name='My Logical Server'
This format includes the metadata object type and an attribute value, such as the name. This format is generally more efficient than just a reference by ID, provided that your type parameter is not Root.
The parameters after the "?" correspond to a valid query with an <XMLSelect search="criteria"> specification. The syntax of the criteria is
object[attribute_criteria][association_path]
For more information about, see <XMLSelect> Element Form and Search Criteria Syntax in the SAS Open Metadata Interface: User's Guide .
Notes:
The omsobj: prefix is case insensitive.
Slashes in the URI can be either a forward slash (/) or a backward slash (\).
Escape characters are supported with the %nn URL escape syntax. For more information, see the URLENCODE function in the SAS Language Reference Dictionary.
| Performance Issues |
For performance reasons, metadata objects are cached by URI within a DATA step or SCL program. To refresh the metadata object with the most recent data from the server, purge the URI with the METADATA_PURGE function .
For best performance, always resolve your URI into an ID instance. This will fully exploit the object caching and reduce the number of reads from the server. For example, if you make several function calls on the object "OMSOBJ:LogicalServer?@Name='foo '" , first use the METADATA_RESOLVE or METADATA_GETNOBJ function to convert the object to "OMSOBJ:LogicalServer\A1234567.A1234567". URIs in the ID instance form usually require only one read from the server per DATA step or SCL program.
| Summary Table of Metadata DATA Step Functions |
The following table lists the SAS metadata DATA step functions in alphabetical order.
| Name | Description |
|---|---|
|
METADATA_DELASSN |
Deletes all objects that make up the specified association |
|
METADATA_DELOBJ |
Deletes the first object specified by the input URI |
|
METADATA_GETATTR |
Returns the named attribute for the object specified by the URI |
|
METADATA_GETNASL |
Returns the nth named association for the object URI |
|
METADATA_GETNASN |
Returns the nth associated object of the association specified |
|
METADATA_GETNATR |
Returns the nth attribute on the object specified by the URI |
|
METADATA_GETNOBJ |
Returns the nth object matching the specified URI |
|
METADATA_GETNPRP |
Returns the nth property on the object specified by the input URI |
|
METADATA_GETNTYP |
Returns the nth object type on the server |
|
METADATA_GETPROP |
Returns the named property for the object specified by the input URI |
|
METADATA_NEWOBJ |
Creates a new metadata object |
|
METADATA_PAUSED |
Determines whether the server is paused |
|
METADATA_PURGE |
Purges the specified URI |
|
METADATA_RESOLVE |
Resolves a metadata URI into a specific object on the current metadata server |
|
METADATA_SETASSN |
Modifies an association list for an object |
|
METADATA_SETATTR |
Sets the named attribute for the object specified by the input URI |
|
METADATA_SETPROP |
Sets the named property for the object specified by the input URI |
|
METADATA_VERSION |
Returns the server model version number |
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.