Hello,
I'm trying to make a function to get the identityGroups of my users with recursion because I want to know the IdentityGroup of my group ...etc.
Here is a sample :
options metaserver="Tiger"
metarepository="Foundation"
metaport=8563
metaprotocol=bridge
metauser="sasadm"
metapass="XXXXXXXXXX";
/********************************************************************************************/
/* GET_USER : */
/* ALLOW TO RETRIEVE FROM METADATA THE UID OF THE USER OBJECT BASED ON THE LOGIN */
/********************************************************************************************/
%global UserUID;
%MACRO GET_USER(user);
data info_user (keep= person_id name login );
length person_id uri newuri login name $256;
length Nobj rc imax 8.;
/* TO GET ALL PERSON IN THE METADATA*/
Nobj = Metadata_GetNobj("OMSOBJ:Person?@id contains '.'",1,uri);
DO j = 1 TO Nobj;
/* GET THE JTH PERSON */
rc = Metadata_GetNobj("OMSOBJ:Person?@id contains '.'",j,uri);
/* GET ID OF THE CURRENT PERSON */
rc = Metadata_GetAttr(uri,"id",person_id);
rc = Metadata_GetAttr(uri,"Name",Name);
/* GET THE RELATED LOGIN OF THE CURRENT OBJECT */
rc = Metadata_getnasn(catx(":","OMSOBJ",person_id),"Logins",1,newuri);
/* GET USERID IN LOGIN */
rc = Metadata_GetAttr(newuri,"UserID",login);
If login = "&user" then
DO ;
j = Nobj;
END;
END;
call symput('UserUID',person_id);
run;
%MEND;
%GET_USER(jnr);
proc fcmp outlib=work.funcs.myfuncs;
subroutine getGroup( id$ );
nbGroup = Metadata_Getnasn(catx(":","OMSOBJ",id),"IdentityGroups",1,GroupUri);
put nbGroup=;
/*DO i = 1 TO nbGroup;
tmp = catx(":","OMSOBJ",id);
rc = %sysfunc(Metadata_Getnasn(tmp,"IdentityGroups",i,GroupUri));
rc = %sysfunc(Metadata_Getattr(GroupUri,"Name",Name));
rc = %sysfunc(Metadata_Getattr(GroupUri,"Id",Id2));
tmp = catx(":","OMSOBJ",id2);
rc = %sysfunc(Metadata_Getnasn(tmp,"IdentityGroups",1,GroupUri2));
output;
if rc > 0 then
call GetGroup(ID2);
END;*/
endsub;
quit;
options cmplib=work.funcs;
DATA Group_user (keep= Name Id nbChild);
LENGTH tmp GroupUri GroupUri2 Name Id $256.;
LENGTH nbGroup 8.;
call GetGroup("&UserUID");
RUN;
Using Metadata_ in %sysfunc() always return -3.
Is it possible to use this kind of functions in FCMP ?
Regards from Belgium.
EDIT :
SAS support :
This is a known bug, The problem is that CMP fails to recognize SAS functions with 16 Character names.
Research and Development have fixed this problem in 9.2 Maintenance 3.
Our latest version shipping of SAS 9.2 is maintenance 2. SAS 9.2 Maintenance 3 is scheduled for release in May of 2010. This date is not guaranteed and may change.
Message was edited by: Lethics