BookmarkSubscribeRSS Feed
filippo_kow
Obsidian | Level 7

 Hi guys,

 

First, I would like to mention that I am not a SAS admin, I am a developer with some particular task to do, so I am asking also for your understanding 🙂

 

I am trying to select all users from our environment (in SAS EG). I found a lot of codes to do that in the net, for example here, in this community (https://communities.sas.com/t5/Administration-and-Deployment/Querying-the-metadata-for-a-list-of-use...). In general, I am trying to call the following function:

nobj = metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);

but in the result I have no records at all. When I change the above code to this one:

nobj = metadata_getnobj("omsobj:Login?@Id contains '.'",n,uri);

I am able to see only my login (with associated identity groups).

 

I would suspect that I don't have proper permissions, but when I go to SAS Management Console and I log-in using exactly the same credentials, I see a lot of users in the repository.

 

Do you have any ideas what should I do to see all users from code run in SAS EG?

 

 Thanks in advance!
 Filip

5 REPLIES 5
andreas_lds
Jade | Level 19

The function call should return the users of the level/environment you are connected to. Can you post the complete step you are using?

filippo_kow
Obsidian | Level 7

 Hi @andreas_lds ,

 

Yes, sure - this is one of the code that I am running:

options metaserver="xxx"
	metaport=8561
	metauser="xxx"
	metapass="xxx"
	metarepository="Foundation";

data fullList;
    length objName $60 objId $17 objType $50;;
    delete;
run;

%macro getMeta(objType);
        data temp(keep=objType objName objId);
            length uri $256 objName $60 objId $17 objType $50;
            uri="";n=1;TableName="";
            objType="&objType";
                do while(metadata_getnobj("omsobj:&objType?@Id ? '.'",n,uri) >= 0);
                        rc=metadata_getattr(uri,"Name",objName);
                        rc=metadata_getattr(uri,"Id",objId);
                        n=n+1; 
                        output;
                end;
        run;
        proc append base=fullList data=temp;
        run;
%mend;
    %getMeta(Person);
	%getMeta(Login);
	%getMeta(User);
/*    %getMeta(PhysicalTable);*/
/*    %getMeta(RepositoryBase);*/
/*    %getMeta(Machine);*/
/*	%getMeta(sasLibrary);*/

The other one is from this community, you can find it here: https://communities.sas.com/t5/Administration-and-Deployment/Querying-the-metadata-for-a-list-of-use...

 

 Cheers,

 Filip

andreas_lds
Jade | Level 19

The code works like charm on my server with my normal / dev account. Of course, the last call with objType = User returns nothing, because the type doesn't exist. But Logins are returned for myself and i get all persons.

 

I have no explanation for the effect you have. If users are visible in smc, i can't think of anything that would prevent listing those user using code.

filippo_kow
Obsidian | Level 7

Thanks for the info. It is very strange, because in one of our environment it works fine (it shows all users), and in other it doesn't work. I will let you know if I find anything else.

 

 Thanks,

 Filip

gwootton
SAS Super FREQ

Note that what is returned depends on what the user connecting to Metadata has permission to see. You may want to try adding something to connect as the unrestricted user, like:

 

options metauser="sasadm@saspw" metapass="password";
--
Greg Wootton | Principal Systems Technical Support Engineer

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 534 views
  • 1 like
  • 3 in conversation