24 %macro mm_adduser2group(user=
    29 %local check uuri guri;
    33   length uri type msg $256;
    34   call missing(of _all_);
    35   rc=metadata_getnobj(
"omsobj:Person?@Name='&user'",1,uri);
    37     msg=
"WARNING: rc="!!cats(rc)!!
" &user not found "!!
    38         ", or there was an error reading the repository.";
    39     call symputx(
'check',msg);
    43   call symputx(
'uuri',scan(uri,2,
'\'));
    45   rc=metadata_getnobj(
"omsobj:IdentityGroup?@Name='&group'",1,uri);
    47     msg=
"WARNING: rc="!!cats(rc)!!
" &group not found "!!
    48         ", or there was an error reading the repository.";
    49     call symputx(
'check',msg);
    53   call symputx(
'guri',scan(uri,2,
'\'));
    55   rc=metadata_getnobj(
"omsobj:Person?Person[@Name='&user'][IdentityGroups/*[@Name='&group']]",1,uri);
    57     msg=
"WARNING: rc="!!cats(rc)!!
" &user already in &group";
    58     call symputx(
'check',msg);
    62   if &mdebug ne 0 then put (_all_)(=);
    66 %
if %quote(&check) ne %quote(ok) %then %
do;
    71 %
if %length(&syscc) ge 4 %then %
do;
    72   %put WARNING:  SYSCC=&syscc, exiting &sysmacroname;
    77 filename __us2grp temp;
    79 proc metadata in= 
"<UpdateMetadata><Reposid>$METAREPOSITORY</Reposid><Metadata>    80     <Person Id='&uuri'><IdentityGroups><IdentityGroup ObjRef='&guri' />    81     </IdentityGroups></Person></Metadata>    82     <NS>SAS</NS><Flags>268435456</Flags></UpdateMetadata>"    86 %
if &mdebug ne 0 %then %
do;
    89     infile __us2grp lrecl=32767;
    95 filename __us2grp clear;