Chapter Contents |
Previous |
Next |
Administrator Tasks — Creating Metadata |
The sample SQL metadata-generating program supplied with this release can be modified to suit the needs of individual organizations. This section explains how to modify the original program to suit your needs. The original program is included in Sample Metadata-Generating Program of this document.
To create metadata:
libname metadata <shared location>; libname library1 <data source 1>; libname library2 <data source 2>; ...
Depending on which DBMS you are assigning libraries to, you may want to define additional LIBNAME options that are specific to that system.
copy sashelp.qassist.metadict.source
%let sellib=('INFORMIX', SASDATA);
Change the libraries in the brackets to the libraries you defined in the LIBNAME statements in step 1. For example, in the following code, the program is modified to include four libnames: DEPOTS, RETURNED, STOCKS, and SUPPLIER.
%let sellib=('DEPOTS,RETURNED,STOCKS,SUPPLIER);
create table _astdcol as select * from dictionary.columns where (libname=DEPOTS and memname in (ROSSLAIGHRE,SHANNON,COVENTRY,LUTON)) or (libname=SUPPLIER and memname in(MATERIALS,UTILITIES,PACKAGING)) or libname in (RETURNED,STOCKS) order by libname, memname, name; create table _astdtab as select * from dictionary.tables where (libname=DEPOTS and memname in (ROSSLAIGHRE,SHANNON,COVENTRY,LUTON&)) or (libname=SUPPLIER and memname in(MATERIALS,UTILITIES,PACKAGING)) or libname in (RETURNED,STOCKS) order by libname, memname;
In the above code, the program is modified so that only a subset of tables in the DEPOTS and SUPPLIER libraries are included in metadata creation. The rest of the program, which does not require any further modifications, is shown below.
save metadata.create.metadict.source
af cat=sashelp.qassist.metadict.scl
When the SAS code you edited above is executed, two SAS tables, _ASTDCOL and _ASTDTAB, will be created in the METADATA library. Remember to check the log when this is finished.
libname metadata <shared location>; libname library1 <data source 1>; libname library2 <data source 2>; dm af c=sashelp.qassist.metadict.scl;
Save the program and execute it in a batch job.
In subsequent batch jobs, add the following macro to ensure that table and column name aliases in the created metadata do not conflict with aliases that have been saved in previous tasks by SAS/ASSIST software. The macro code should be inserted after the libname statements in the code and reads as follows:
%let update=Y;
Run the batch job each time that the data structure changes. You may want to run it as a scheduled job.
Chapter Contents |
Previous |
Next |
Top of Page |
Terms of Use & Legal Information
| Privacy Statement
Copyright © 2001 SAS Institute Inc. All Rights Reserved.