%BRM_IMPORT_LOOKUP

Imports lookup tables from the specified CSV file into the rules database.

Restrictions: This macro must be run on the server tier.
The same user can run any of import macros at the same time. However, different users cannot run the same import macro simultaneously.

Syntax

%BRM_IMPORT_LOOKUP (CSV=input_filename.CSV,
REJECT=reject_filename.CSV<, options>);

Required Arguments

CSV=input_filename

specifies the full pathname to the CSV file where you want to import the data from.

REJECT=reject_filename

specifies the full pathname to the CSV file where you want the macro to write any records that were not imported to the rules database. See Using the %BRM_IMPORT_LOOKUP Macro for more information.

Optional Arguments

BRM_USER=user_ID

specifies the user ID that you want to be associated with the data that is imported. This user ID is associated with the imported objects in the rules database and is displayed in the SAS Decision Manager interface.

Default User ID of the user that is running the macro

BYPASSLOCK=Y|N

enables you to override the lock that another user has on the importing process. See Using the %BRM_IMPORT_LOOKUP Macro for more information.

Default N

Details

Using the %BRM_IMPORT_LOOKUP Macro

The %BRM_IMPORT_LOOKUP macro enables you to do the following tasks:
  • add new lookup tables
  • add new key-value pairs to existing lookup tables
  • update (refresh) existing key-value pairs in existing lookup tables
The macro uses the lookup table name and path to determine whether a lookup table already exists. If the lookup table already exists, then it is updated. If the path exists but the lookup table does not exist, the lookup table is created. If the path does not exist, then the lookup table is rejected.
The %BRM_IMPORT_LOOKUP macro runs several validation checks as it imports the lookup tables. For example, the macro checks whether the LOOKUP_NM or NAME columns in the input file are empty or whether the LOOKUP_NM column specifies an invalid lookup name. All valid key-value pairs are imported. If the macro finds an invalid key-value pair in the CSV file, it writes a message to the SAS log, and the key-value pair is rejected. The macro writes the input records for the rejected key-value pairs to the CSV file that was specified in the REJECT= option.
When you run the %BRM_IMPORT_LOOKUP macro, it creates a lock table in the rules database named lock_import_lookup table. The SAS log states which user holds the lock and the time at which the lock started. This lock might remain in place after the macro has finished. If this happens, you can override the lock by specifying the BYPASSLOCK=Y option when you run the macro.

Format of the Lookup CSV Input File

Each row of the CSV input file identifies a key-value pair and the lookup table in which it belongs. The CSV file must contain all of the columns listed in the following table, in the order listed. You must specify values for all columns, except as noted in the table. To create a blank column in the CSV file, specify two comma separators without any content between them. For example, to import the key AU and the value Australia into the lookup table Country_Codes and to specify a blank column for the description, specify the following in the CSV file:
Country_Codes,,AU,Australia,Loans/Retail
Format of the Lookup CSV Input File
Column
Description
Can Column Be Blank
FOLDER_PATH
The pathname to the business rules folder where you want to import the lookup table. This path must exist. Separate folder names with forward slashes.
No
LOOKUP_NM
The name of the lookup table.
No
DESCRIPTION
The description of the lookup table.
Yes
NAME
The lookup key.
No
VALUE
The lookup value.
Yes