Assuming you have a table of users and their desired Identifier values (here I'm creating the table work.users manually), you could do something like this:
/* Create a data set of users and their desired external identity values. */
data work.users;
length user identifier $ 255;
input user $ identifier $;
datalines;
sasadm 12345
sasdemo 67890
;;
run;
/* DATA step to update these objects. */
data _null_;
/* Initialize some variables. */
length type id $ 50 uri extid $ 255;
call missing(type,id,uri,extid);
/* Read in the source data set. */
set work.users;
/* Define a query to find the ExternalIdentity object associated with that user. */
obj="omsobj:ExternalIdentity?ExternalIdentity[OwningObject/Person[@Name='"||trim(user)||"']]";
rc=metadata_resolve(obj,type,id);
/* If one (and only one) is found... */
if rc = 1 then do;
put "NOTE: Found 1 external identity for user " user ;
/* Get the URI for the object. */
rc=metadata_getnobj(obj,1,uri);
/* Pull the existing identifier value. */
rc=metadata_getattr(uri,"Identifier",extid);
/* Only take action if the existing value does not match the desired value. */
if extid ne identifier then do;
put "NOTE: Identifier does not match table." extid= identifier=;
put "NOTE- Setting attribute to value in table.";
/* I've commented out the line that writes to metadata and replaced it with rc=0 to simulate a successful write. */
/* To activate this code, uncomment the metadata_setattr function and comment out the rc=0. */
*rc=metadata_setattr(uri,"Identifier",identifier); rc=0;
if rc=0 then put "NOTE: Attribute updated successfully";
else put "ERROR: Failed to update attribute for user " user rc=;
end;
else put "NOTE: No action needed, external id already matches desired value. " extid= identifier=;
end;
else put "NOTE: Taking no action. Found " rc "external identities for user " user;
run;
--
Greg Wootton | Principal Systems Technical Support Engineer