/*Specify connection options. Use an unrestricted user ID.*/
options metaserver=machine-name
metauser="userID"
metapass="password";
/*Specify the directory for the extracted AD data (master
tables).1*/
libname adir "drive:\path\ADIRextract";
/* Specify the directory for the extracted metadata (target tables).*/
libname meta "drive:\path\METAextract";
/* Specify the directory for the comparison output (change tables).*/
libname updates
"drive:\path\METAupdates";
/* Extract identity information from AD (master).2*/
%let _EXTRACTONLY = ;
%include "drive:\path\myimportad.sas";
/* Extract identity information from the metadata (target).*/
%mduextr(libref=meta);
/* Compare AD (master) to metadata (target).3*/
%mducmp(master=adir, target=meta, change=updates);
/* Validate the change tables.*/
%mduchgv(change=updates, target=meta, temp=work, errorsds=work.mduchgverrors);
/* Load the changes into the metadata.4*/
%mduchglb(change=updates);
The numbers in the preceding
code correspond to these points:
-
The AD extract location
should match the importlibref location in your import program. For
example, if your original importad.sas put the normalized AD data
in the work library, you might revise importad.sas by replacing the
line:
%let importlibref=work;
with these
two lines:
libname adir "drive:\path\ADIRextract";
%let importlibref=adir;
-
This causes the importad.sas.
program to only extract the data (and not perform the load).
-
If you need to exclude
items from the comparison, add the EXCEPTIONS=
dataset parameter here.
-
If you prefer to not
load any changes if %MDUCHGV finds an integrity violation, replace
the displayed line with this code:
%macro exec_mduchglb;
%if (&MDUCHGV_ERRORS ^= 0) %then %do;
%put ERROR: Validation errors detected by %nrstr(%mduchgv). Load not attempted.;
%return;
%end;
%mduchglb(change=updates);
%mend;
%exec_mduchglb;