/****************************************************************************** * Programme : Extrahieren von E-Mail-Adressen aus SAS-Metadaten * Reference : EXTRAHA7B5 * Source : https://www.wearecas.eu/fr/sampleCode/EXTRAHA7B5 ******************************************************************************/ /* --- BLOC 1 --- */ options metaserver="my.sas.server" metaport=8561 metauser="sasadm @saspw" metapass="password" metarepository=Foundation metaprotocol=BRIDGE; /* --- BLOC 2 --- */ data work.emails; /* Create a dataset, work.emails. */ /* define and initialize variables. */ length type id email_add email_uri user_uri user_name $ 50; call missing (type,id,email_add,email_uri,user_uri,user_name); /* Count the email objects defined in Metadata. */ email_count=metadata_resolve("omsobj:Email? @code_sas_json/identity.json contains '.'",type,id); /* If any are present, for each one gather their attributes. */ if email_count > 0 then do n=1 to email_count; rc=metadata_getnobj("omsobj:Email? @code_sas_json/identity.json contains '.'",1,email_uri); rc=metadata_getattr(email_uri,"Address",email_add); rc=metadata_getnasn(email_uri,"Persons",1,user_uri); rc=metadata_getattr(user_uri,"Name",user_name); output; /* Write the attributes gathered to the dataset. */ end; run;