Sample 25274: Registering a SAS MDDB in Batch
Many people choose to build their SAS Multidimensional Databases (MDDB), during off hours to provide as many resources to the task as possible. Ideally you would also like to register your new MDDB at the same time. The SAS Component Language (SCL) program code included below uses metabase and environment classes to accomplish this task.
The first step is to create an SCL entry. You must have SAS/AF Software installed to create an SCL entry. You can create a new entry with the BUILD command as in the following example:
build sasuser.mddbcat.reg_mddb.scl
Once the BUILD window is open, copy the following program code into the SCL entry.
/* Load the MB catalog */
import sashelp.mb;
dcl metabase mbid;
dcl resenv resid;
dcl char msg repositoryName mddbName;
INIT:
resid=_new_ resenv();
/* get the repository information from the environment */
mbid=getnitemn(envlist('L'),'METABASE');
repositoryName=symget('repository');
mddbName=symget('table');
/* if base table doesn't exist, prevent prompt window from displaying */
rc = setnitemc(envlist('L'), 'Y', '_EIS_NOPROMPT');
/* register the MDDB in the specified repository */
mbid._registerMddb(rc,msg,repositoryName,mddbName);
if rc ne 0 then put msg;
mbid._term();
resid._term();
return;
|
Save and compile the entry.
After the SCL entry has been created, the code can be executed in a batch environment via PROC DISPLAY. In the following example, SASUSER.MDDBCAT.REG_MDDB.SCL is the SCL entry that contains the batch registration code.
Be sure the repository name and the repository macro value have the same case.
/***************************************************
Syntax for calling program:
+------------+--------------------------------+
| repository | Name of repository in which to |
| | register MDDB |
+------------+--------------------------------+
| table | Name of MDDB |
+------------+--------------------------------+
***************************************************/
%let repository = sasuser;
%let table = sashelp.prdmddb;
proc display c=sasuser.mddbcat.reg_mddb.scl;
run;
|
About the Author
Adam Budlong is a Technical Support Analyst for Business Applications. His primary areas of support are OLAP applications and SAS/AF. He has been a part of the Technical Support team since June 2000.
Shows a SAS Component Language (SCL) program that uses metabase and environment classes to register your new MDDB when it is created.
| Date Modified: | 2009-01-16 14:40:12 |
| Date Created: | 2005-03-31 16:22:52 |
Operating System and Release Information
| SAS System | SAS/AF | All | 8 TS M0 | n/a |