Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Tip: Global Data Sources

SAS Employee
Posts: 22

Tip: Global Data Sources

Did you know that you can use your global data sources to specify metadata that can be used across multiple users, diagrams, and projects?  This is ideal if there are data sources that you use regularly as you no longer have to redefine that metadata over and over again. As outlined in the documentation, the key is to use a libname statment with the libref EMGDS. 

Super Contributor
Posts: 336

Re: Tip: Global Data Sources

I was just talking to a colleague about global data sources. We came up with the example below. More information available in the SAS Enterprise Miner Reference Help, in the section Enterprise Miner Data Sources.

Here an example that I hope helps you save some time getting started with Global Data Sources.

1. Base SAS quick-and-dirty way to generate a generic metadata table.


The path from mydata library (e.g. 'D:\My Publications\SGF2012') is the path where your data is happily stored.

The path for EMGDS library (e.g. 'D:\All_Users\miguel' ) is the path where you will put all your Global Metadata data sets from now on.

The /* create EM macros */ section loads the EMDS macro so that you can get a metadata table in no time.

In the call for the %EMDS macro you will change mydata.data_orlando for a data set that you use a lot. If you don’t have any data set in mind, feel free to run it for any dataset e.g. %EMDS( This will expedite things for step 2.


In Base SAS run the below (you could run it in SAS Enterprise Miner too but it helps to do it in base SAS for step 2):

/* libname for global data source location */

libname mydata 'D:\My Publications\SGF2012';

libname EMGDS 'D:\All_Users\miguel';

/* create EM macros */

filename code catalog 'sashelp.emutil.emds.source';

%include code;


After running this code, notice that the EMDS macro created three tables for you. The one you care about has a _cm suffix. For example, I ran this for mydata.data_orlando and the table I want is Dataorlando_cm. Feel free to delete the other two data sets.


2. Modify the metadata table.

You can just double click on it to modify it or you can use code.

Let’s say you are interested in the variable Loan_Default. It should always be a binary target.

One option to do that is to use the Edit mode in base SAS (highlighted red box below). I typed the Role and Level column as below.


Another option is to use code. Since the columns have been defined, it is way easier than starting from scratch.

For example, you can also run in base SAS:

data EMGDS.miguelsEMGDS;

set EMGDS.dataorlando_cm;

where name="Loan_Default";




            Since you are only interested in the variable named “Loan_Default” feel free to delete the table EMGDS.dataorlando_cm. Also add any other variables that you use frequently across many projects.

Once you have defined all the metadata options for the variables you need, go to Enterprise Miner.

3. Specify the location of a EMGDS library in Enterprise Miner.

In the project startcode define an EMGDS library with the path to the table you have just created. In my example, I copied this line from the first code (libname EMGDS 'D:\All_Users\miguel';).


After these 3 steps you are good to go!

Any time you include a variable called Loan_Amount, SAS Enterprise Miner will set it as a binary target, as per the definitions in the Enterprise Miner Global Data Set (EMGDS) library.

I hope it helps,


Ask a Question
Discussion stats
  • 1 reply
  • 1 like
  • 2 in conversation