space
Previous Page | Next Page

Understanding SAS/EIS Metadata Attributes

User-Defined Attributes in SAS/EIS Software

You can define your own attributes in the SAS/EIS metabase facility. Even though you can assign user-defined attributes to any data that you register in a repository, only user-written objects or methods use them.

To define and use your own attributes with SAS/EIS software, follow these steps:

  1. Create an attribute dictionary using the Attribute Dictionary window of the metabase facility.

  2. Define the attribute in your own dictionary, developing any custom assign methods first.

  3. Put all the user-defined attribute dictionaries you need in the Attribute Dictionary Search Path window of the Setup menu in the SAS/EIS development environment.

  4. Activate the attribute search path in the Attribute Search Path window of the Setup menu in the SAS/EIS development environment.

  5. Assign the same librefs for the SAS data libraries that contain your user-defined attribute dictionaries as you used in the attribute search path specification.

  6. Assign your attributes to your data in a metabase registration, using either your own methods or the interface that is provided by the SAS/EIS metabase facility.

  7. Write your own objects to take advantage of your new attributes, and use them to define applications with SAS/EIS software.

The following sections describe how to use the metabase facility to perform all the operations needed to use user-defined attributes and user-defined attribute dictionaries in SAS/EIS software.


User-Defined Attribute Dictionaries

The SAS/EIS metabase facility creates a SAS table to contain user-defined attributes. In order to use attribute dictionaries that you define with SAS/EIS software, you must specify the name of the dictionary and activate the search path in which the dictionary is stored. You can do this by selecting Edit [arrow] Attribute dictionary search path in the Attribute Dictionary window or by selecting Search path [arrow] Attribute search path from the Setup menu.


Requirements and Methods for User-Defined Attributes

You define your own attributes to use in objects that you write yourself. Attributes that you define in your own attribute dictionary have no meaning unless you register data with the attributes in a repository and write programs that use or look for data that is registered with those attributes.

To define attributes, provide the name of the attribute, its type, and a description. You can also provide the location of up to three assign methods. Assign methods are SAS/AF FRAME, PROGRAM, or SCL entries that you write yourself to handle special cases in assigning attributes when you register data. Assign methods can be any of the following:

Interactive assign method

Design this method to edit the value associated with each attribute by providing valid choices. The methods that are supplied by SAS for assigning and editing the HIERARCH attribute or the ANALYSIS attribute show examples of interactive methods that provide choices for supplying an attribute value. For more information about attributes, refer to the SAS/EIS online Help for the Advanced window. If an attribute that you define requires no value, you do not need to specify an interactive assign method for that attribute.

Automatic assign method

Design this method to automatically assign attributes to SAS tables or columns during registration. Automatic assign methods can also automatically set values for attributes during registration. For example, you can define an automatic assign method that cancels numeric column registrations and registers only character columns. A user-defined attribute with either a specified automatic assign method or an attribute type of AUTODATA or AUTOVAR will be automatically assigned during registration.

De-assign method

Design this method to remove attribute assignments based on some trigger or to handle special cases posed by the deletion of certain attributes. For example, deleting the CSFDS table attribute necessitates deleting the CSF column attribute from any column that contains the CSF column attribute.

When you create an SCL program to be used as an assign method, include the following parameters in the ENTRY statement:

entry rc 8 status $ l_parms 8

where

Parameter
Is type... And Contains...
rc N the return code of the entry.
status C 'E' when the status is OK or 'C' when the user cancels.
l_parms N a named item list with the following items:

ATTRNAME = attribute, which is the name of the attribute.

METABASE = metabase, which is the object ID of the metabase class object. You can retrieve this value from the local environment using the following code:

metabase=getnitemn( envlist('L'), 'METABASE');

DSNAME = dsname, which is the name of the SAS table that is being processed.

VARNAME = varname, which is the name of the column that is being processed.

VALUE = value, which is the value that is assigned to the attribute.

In the following example, an interactive assign method updates the value of the PATH attribute.

entry rc 8 status $ l_parms 8;

INIT:

   dsname=getnitemc(l_parms,'dsname');
   libref = scan(dsname, 1, '.');
   value  = pathname(libref);
   if value = _blank_ then
      call nochange();
   else
       l_parms=setnitemc(l_parms,value,'value');
   return;


Attribute Types That Are Automatically Assigned

All SAS/EIS default attributes are automatically assigned during registration. To automatically assign a user-defined attribute when you register SAS tables or SAS table columns, follow these steps:

  1. Create the attribute that you want to automatically assign with the AUTODATA type for SAS table attributes or with the AUTOVAR type for columns.

  2. Add the attribute dictionary that contains the attribute to the Attribute Dictionary Search Path window in the Setup menu. Activate the search path.

  3. Register your SAS table in a repository. The SAS table automatically has many attributes of type AUTODATA, and each column automatically has many attributes of type AUTOVAR.

space
Previous Page | Next Page | Top of Page