User Import Macros |
This code demonstrates one way to import generic identity information. This example is intended to illustrate the structure and relationships of the identity data, rather than to suggest that you enter large quantities of data using this approach. The program uses macro variables to define the tables and uses DATALINES statements to supply input data. The %MDUIMPLB macro creates XML from the tables and submits that XML (in blocks) to the metadata server.
/* Specify connection options. Use an unrestricted user ID. */ options metaserver=machine-name metauser="userID" metapass="password"; /* Initialize the macro variables that create canonical tables. */ %mduimpc(); /* Create the person table. */ data &persontbla ; %definepersoncols; infile datalines delimiter=',' missover; input keyid name description title; datalines; P001,Michelle Harrell,Mgr of Operations,Sr. Mgr P002,Fred Granite,NE Region Acct. Rep.,Account Rep II P003,Brian Davis,Accounting System Developer,Senior Programmer ; /* Create the phone table. */ data &phonetbla ; %definephonecols; infile datalines delimiter=',' missover; input keyid phoneNumber phoneType; datalines; P001,x1532,Office P001,(919) 555-1212,Home P003,x2312,Office ; /* Create the location table. */ data &locationtbla ; %definelocationcols; infile datalines delimiter=',' missover; input keyid locationName locationType address city postalcode area country; datalines; P001,My Company,Office,123 Oak Ave,Clayton,20711,CA,USA P001,Michelle Harrell,Home,105 Seth Ct.,Apex,20765,CA,USA P002,Fred Granite,Home,2138 Pond St.,Greenlevel,20832,CA,USA P002,My Company,Office,123 Oak Ave,Clayton,20711,CA,USA P003,My Company,Office,123 Oak Ave,Clayton,20711,CA,USA ; /* Create the email table. */ data &emailtbla ; %defineemailcols; infile datalines delimiter=',' missover; input keyid emailAddr emailtype; datalines; P001,michelle@mycompany.com,business P001,bosslady1@hotmail.com,home P002,fred@mycompany.com,business P003,brian@mycompany.com,business ; /* Create the idgrp table. */ data &idgrptbla ; %defineidgrpcols; infile datalines delimiter=',' missover; input keyid name description grpType; datalines; G001,Operations Staff,Members of the operations department, G002,All Groups,Group containing all groups, G003,Backup Operators, , ; /* Create the grpmems table. */ data &idgrpmemstbla; %defineidgrpmemscols; infile datalines delimiter=',' missover; input grpkeyid memkeyid; datalines; G001,P001 G002,G001 G002,G003 G003,G001 G003,P003 ; /* Create the authdomain table. */ data &authdomtbla; %defineauthdomcols; infile datalines delimiter=',' missover; input keyid authDomName; datalines; A001,DefaultAuth A002,UnixAuth ; /* Create the logins table. */ data &logintbla; %definelogincols; infile datalines delimiter=',' missover; input keyid userid password authdomkeyid; datalines; P001,WinNet\Michelle, ,A001 P001,Michelle, ,A002 P002,WinNet\Fred, , P003,WinNet\Brian, , P003,Brian, ,A002 ; /* Load the information from the work library into the metadata server. */ %mduimplb();
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.