Hi, could some help me or provide some sample code? We want to use it in Ansible automation to automatically generate user account, instead of sas management console. thanks
%macro meta_create_user(username, login=, memberof=);
for example
%macro meta_create_user(testuserFN testuserLN, login=testuser1, memberof=testgroup1); or
%macro meta_create_user(testuserFN testuserLN, login=lestuser1, memberof=(testgroup1,testgroup2));
@Tom2021 Before trying to write your own macro from scratch you might want to inspect what's already provided in the docu under User Import Macros.
thanks Patrick, but, i tried %MDUCHGLB User Import Macro that cannot add user into existing group; all users and groups should be new from ad/unix/other external. they cannot have same names in metadata repository. i like to do more investigation.
Thank you Allan,
I read and tested your macro code. it is beautiful. it worked very well to add an existing user into specified groups. Could I use your macro file mm_adduser2group.sas?
My outstanding question or task is to create a macro to create a new user with user name and login id.
In the same time, I will try another approach suggested in the communication thread to use bulk load and sas macro %mduchgbl. Finally, I will choose the simpler one.
Thank you again.
In the examples directory of the SAS installation, you can find two programs (importpw.sas and importad.sas) that synchronize the metadata either with the UNIX passwd/group files or an Active Directory (LDAP) source. They manage everything (adding users/groups, add in users to existing groups, apply changes to existing users/groups, remove groups or users).
We have used both programs as blueprints for our sync needs, and they work perfectly.
The programs consist of two parts: first extracting the user/group data from the source into a miniature database, and second creating a mirror base from the metadata, which is compared, resulting in a set of datasets for deleting, changing and adding metadata objects.
As long as you create the database correctly, the rest of the programs should work.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.