BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Hi,

I am new with SAS SMC 9.1. I had created new user in SAS SMC 9.1.

Now, I need a report which contain list of user created from SAS SMC 9.1.

It is like user tracking list. Can I get this kind of report from SAS SMC 9.1?

Thank you.

Regards,

Senico

1 ACCEPTED SOLUTION

Accepted Solutions
Bago
SAS Employee

Hey,

You could use a datastep to retrieve the users registered in the metadata e.g. :

/* example */

/* connect to metadataserver */

options metaserver=""                   /* specify metadataserver */  

metaport=8561                             /* metadata server port */

metauser=""                                 /* user id : e.g. SAS Administrator --> sasadm */

metapass=""                   /* user password          */

metarepository="Foundation"

metaprotocol=BRIDGE;

/* retrieve list of users */

data _null_;
  length uri $256 user $100;
  nobj=1;
  n=1;
  do while(nobj >= 0);
  nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
      if (nobj < 0) then leave;
      arc=metadata_getattr(uri,"Name",user);
     put n= user=;
     n=n+1;
  end;
run;

/* end example */

If you want to create a list containing groups change Person by IdentityGroup.

If you want to create a list containing both groups and users change Person by Identity.

Instead of writing the user information to the log you can write it to a dataset. You can use this dataset to create reports.

Besides retrieving the name of the users you can extract extra information from the metadata such as when the user was created. To know this you would retrieve information about the inherited attibute "MetadataCreated" (http://support.sas.com/documentation/cdl/en/omamodref/61849/HTML/default/viewer.htm#person.htm ) e.g.

arc=metadata_getattr(uri,"MetadataCreated",MC);

FYI : SAS ® 9.1.3 Open Metadata Interface : http://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_913/omd_ref_10177.pdf

Regards,

Bago

View solution in original post

3 REPLIES 3
Bago
SAS Employee

Hey,

You could use a datastep to retrieve the users registered in the metadata e.g. :

/* example */

/* connect to metadataserver */

options metaserver=""                   /* specify metadataserver */  

metaport=8561                             /* metadata server port */

metauser=""                                 /* user id : e.g. SAS Administrator --> sasadm */

metapass=""                   /* user password          */

metarepository="Foundation"

metaprotocol=BRIDGE;

/* retrieve list of users */

data _null_;
  length uri $256 user $100;
  nobj=1;
  n=1;
  do while(nobj >= 0);
  nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
      if (nobj < 0) then leave;
      arc=metadata_getattr(uri,"Name",user);
     put n= user=;
     n=n+1;
  end;
run;

/* end example */

If you want to create a list containing groups change Person by IdentityGroup.

If you want to create a list containing both groups and users change Person by Identity.

Instead of writing the user information to the log you can write it to a dataset. You can use this dataset to create reports.

Besides retrieving the name of the users you can extract extra information from the metadata such as when the user was created. To know this you would retrieve information about the inherited attibute "MetadataCreated" (http://support.sas.com/documentation/cdl/en/omamodref/61849/HTML/default/viewer.htm#person.htm ) e.g.

arc=metadata_getattr(uri,"MetadataCreated",MC);

FYI : SAS ® 9.1.3 Open Metadata Interface : http://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_913/omd_ref_10177.pdf

Regards,

Bago

senico82_gmail_com
Calcite | Level 5

Thanks Bago.

Your answer is really useful.

Thanks again.


bijay
Calcite | Level 5

Hi I was trying to get SAS Users list and run the above mentioned code. I got the following message:

 NOTE: Variable uri is uninitialized.
NOTE: Variable user is uninitialized.

Do i need to do some modification in the code other than the specifications to be provided in options.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 3184 views
  • 0 likes
  • 3 in conversation