Preparing Data for Your Ready-Made Applications |
The metabase facility is a graphical user interface that enables you to identify and manage your data for SAS/EIS objects. The metabase facility usually includes one or more repositories, columns databases, and attribute dictionaries. Because you can register data other than SAS data sets, the metabase facility uses the term table instead of data set and column instead of variable to describe what you register in the repository.
The metabase facility stores information in the following:
contain metadata information that describes SAS tables, MDDBs, and columns.
contains columns and associated attributes to be used automatically when tables are registered in a repository.
contain a set of descriptive characteristics or attributes that you can associate with specific SAS tables or columns in a repository.
You use the Metabase window to access the SAS/EIS metabase facility, which enables you to register data, to copy data registrations, and to create, delete, or edit repository files. To access the Metabase window, double-click Metabase in the EIS Main Menu.
For more information on repositories, columns databases, and attribute dictionaries, refer to the SAS/EIS online Help.
What Is a Repository? |
A repository stores information about your data. It is a physical path or directory. A repository does not contain the actual tables that you register with it; instead, it contains data about the tables that you register with it, as shown in the graphic below.
Anatomy of a Repository
Each repository can contain information describing one or more tables. Each table that you register in a repository creates a registration in that repository. A table can have registrations in more than one repository.
The first time that you invoke the SAS/EIS development environment, a default repository is automatically created for you under the path of your SASUSER library. You can use the default repository to register data immediately, and you can also create and use other repositories in other libraries.
Only one repository is active at any time, and any change, addition, or deletion you make occurs only within the active repository. For more information about repositories, refer to the SAS/EIS online Help.
What Is a Metabase Registration? |
A metabase registration is a block of information that is related to a single SAS data file. Each repository can contain registrations for one or more SAS data files. A multidimensional database (MDDB) is registered in the same way as a SAS table. When you register or define a SAS table in the repository, the default table and column attributes are read and stored.
Many objects require information that is not available outside SAS/EIS software, such as
When you register data in a repository, default attributes are assigned to each table and column. You must assign attributes in order to qualify your data for use in developing some applications with SAS/EIS objects. The kinds of extended attributes that you assign to your data determine the kinds of objects that recognize the attributes when you develop applications. For example, some objects use data that has extended attributes, such as SUMMARY and HIERARCH, so that you can use the objects more efficiently. Other objects might use a multidimensional database (MDDB) to provide summarized data.
Every time you add, edit, or delete metabase registrations, you change the contents of the repository.
By default, metabase registrations have the same name as the table that you register to create them. However, the metabase registration name can be different from the table name (it can be any character string of up to 41 characters). You can copy a registration using a new name other than the table name. You can also rename registrations to names other than the table names.
What Is a Columns Database? |
A columns database contains a list of column names with specified default and extended attributes that can be associated with tables that you register in a repository. When you register a table in the repository, if the repository finds a column in the columns database with the same name as a column in the table, the column is registered using the attributes from the columns database.
Defining column attributes in a columns database is useful especially when the same column name appears in multiple tables and you want to register the columns with the same or similar attributes. For example, suppose the column SALES, which represents actual sales per quarter, exists in four separate tables, QTR1-QTR4. You want to assign the extended attributes ACTUAL and ANALYSIS to each SALES column. You can add the SALES column to the columns database and specify the above attributes. Then, when tables QTR1-QTR4 are registered, the SALES column in each table will be registered with the extended attributes ACTUAL and ANALYSIS.
You can have only one columns database per repository. Any table registered in the repository will pick up column attribute information from the columns database in the given repository. To create or modify a columns database, access the Metabase window and specify a repository. Select Edit Columns Database in the Metabase window to open the Columns Database window, where you can add and delete columns and attributes in the columns database.
What Are Attributes and Attribute Dictionaries? |
In SAS/EIS software, an attribute is a characteristic of a registered SAS/EIS data resource (for example, a table or a column). You can associate different values with each attribute.
Some attributes already exist by default in traditional SAS tables. For example, the following are default column attributes for SAS tables:
Dynamic or extended attributes are characteristics that you associate with registered tables and columns in a repository. Some extended attributes determine the availability of data while you define applications in the development environment. For example, when you register a table in a repository, you can associate the dynamic attribute HIERARCH with the table. The value of the HIERARCH attribute is the name of the .SLIST entry that contains drill-down information. Specify this table when you create a new object so that you can use this dynamic attribute to create a drill-down hierarchy within your application. For more information about attributes, refer to About SAS/EIS Metadata Attributes.Other extended attributes provide information about your data to SAS/EIS applications as they execute. For example, the PROLOG and EPILOG attributes specify pre- and post-processing activities that occur when an application runs. SAS/EIS provides a default set of extended attributes.
An attribute dictionary is a table that is created by the metabase facility. It contains attributes that are available for the process of registering SAS/EIS resources. These attributes specify the type of resource to which they can be assigned, as well as the SCL programs that control the processing. For more information about attribute dictionaries, refer to About Attribute Dictionaries.
associate attributes with SAS tables or SAS table columns in a repository
create your own attributes and store them in attribute dictionaries that you create and maintain
query a repository or an attribute dictionary to determine attribute values using SAS/EIS repository methods in objects that you write.
For more information on user-defined attributes, refer to User-Defined Attribute Dictionaries.
Extended Attributes in the Default Attribute Dictionary |
When you build a SAS/EIS application, the object queries the repository for the attributes that are associated with the table you have selected. You must register the table with the attributes that are appropriate for your application before you can build the application. For example, several objects require that you assign the ANALYSIS attribute to a variable or a column, but only the Variance Report object requires that you assign the BUDGET attribute.
When you open the Select Attributes window by clicking in the Attributes list box on the Columns window, you can associate one or more of the attributes with a column. See the SAS/EIS online Help for more information about extended attributes.
Some attributes have additional features in SAS/EIS software. The following list explains the additional features for the most commonly used attributes:
makes numeric variables available when you define SAS/EIS applications. When you assign the ANALYSIS attribute to a column, you also assign default statistics. The repository default statistic is SUM, but you can assign other statistics to use as defaults. See the SAS/EIS online Help for more information.
specifies that any processing of the data for reporting purposes will be performed on the host where the data is stored. The COMPSRV attribute can be assigned to any table or MDDB that exists on a remote host.
performs processing after a table has been accessed by objects either at run time or in the development environment. For example, you could specify an EPILOG program that uploads a table to a remote host and then signs off from the host. Refer to the EPILOG Attribute Example for more information.
specifies the HIERARCH table attribute, which you use in the following applications:
A hierarchy defines the drill-down order between columns in a table. The order that you specify in the hierarchy controls the default order for drilling down when you use the hierarchy in applications that support the HIERARCH attribute. You can define multiple hierarchies for a given table.
is used in MAP applications. The MAPINFO attribute requires the HIERARCH attribute as well as at least one column that has the ANALYSIS attribute assigned to it.
performs processing before a table is accessed by objects either at run time or in the development environment. For example, you could specify a PROLOG program that signs on to a remote host and then downloads a copy of a table to use in a chart application. Refer to PROLOG Attribute Example for more information.
identifies tables that contain presummarized data. The attribute value identifies the _TYPE_ column and the hierarchy that were used to summarize the data. Tables that are registered with the SUMMARY attribute can be used in the following objects: Comparison Report, Expanding Report, Grouped Bar Charts, and Multicolumn Reports. For more information, refer to SUMMARY Attribute Example.
When you create an SCL program to be used for PROLOG processing, include the following parameters in the ENTRY or METHOD statement:
return-code, metabase, dsname
The following is an example of a PROLOG program that uses SAS/CONNECT software to sign on to a remote host and download a table to the WORK library. This program then sets the DSNAME value to WORK.PRODSALE so that any SAS/EIS objects that use this registration can use the downloaded table.
PROLOG: method rc 8 metabase 8 dsname $41; put 'NOTE: Prolog processing started.'; /* check for existing session and sign on */ rc = rlink('os390'); if rc = 0 then do; put 'NOTE: Prolog signing on to OS/390.'; submit continue; options remote=os390 comamid=tcp; signon os390; rsubmit; libname sales 'MY.OS390.DATA' disp=shr; proc download data=sales.prodsale out=work.prodsale; run; endrsubmit; endsubmit; end; else do; put 'NOTE: Prolog already signed on to OS/390.'; submit continue; options remote=os390 comamid=tcp; rsubmit; libname sales 'MY.OS390.DATA' disp=shr; proc download data=sales.prodsale out=work.prodsale; run; endrsubmit; endsubmit; end; dsname = 'WORK.PRODSALE'; put 'NOTE: Prolog processing completed.'; endmethod;
When you create an SCL program to be used for EPILOG processing, include the following parameters in the ENTRY or METHOD statement:
return-code, metabase, dsname
The following is an example of an EPILOG program that uses SAS/CONNECT software to sign off from a remote host connection that was established in the PROLOG program:
EPILOG: method rc 8 metabase 8 dsname $41; put 'NOTE: Epilog processing started.'; /* check for existing session and sign off */ rc = rlink('os390'); if rc = 1 then do; put 'NOTE: Epilog signing off of OS/390.'; submit continue; signoff os390; endsubmit; end; else put 'NOTE: Epilog already signed off of OS/390.'; put 'NOTE: Epilog processing completed.'; endmethod;
Suppose that you want to display a summarized table that contains the following drill hierarchy:
Your PROC SUMMARY code might look like the following:
proc summary data=sasuser.sales; class zipcode city region area; var qtr1 qtr2 qtr3 qtr4; output out=sasuser.sumsales sum=; run;
Note: The order of the variables in the hierarchy is the reverse of the order in which they are specified in the CLASS statement.
To assign the SUMMARY attribute, follow these steps:
Verify that at least one hierarchy with the HIERARCH attribute has been defined for the table. If not, assign the HIERARCH attribute to the table. Be sure to specify the hierarchy variables in the reverse order from the CLASS statement in PROC SUMMARY.
Click under the Attributes list box in the Metabase window and then select Summary from the list of attributes. Click to assign the attribute.
Verify that the information displayed in the Summary window is correct. The window will have default values for the fields. These values are based on the previously registered hierarchy and on some assumptions about what type of output table PROC SUMMARY produces.
For additional information on using summarized data, see Presummarizing Your Data.
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.