BookmarkSubscribeRSS Feed
Calcite | Level 5



Is there a way through which I can create users on SAS console through a script/code using a csv.


So i have list of around 500 users in an excel, and the task is to create the list of users for them to access SAS studio. Being a rookie on SAS, i just know one way to add users i.e. adding manually through SASMC and doing it for all 500 users.


I found this macro %MDUIMPC for importing users ( in SAS. As i understand this method creates tables in SAS environment which can then be used for creating users.


As of now I am stuck on the part where its asking to import a csv version of users.


Here I wanted to understand if there is any specific format required for the csv of users.


Alternately, if anyone knows any other way the please share.





Amethyst | Level 16

Hello @anujsri,


you are walking on the right path. The key for you is that you need to convert that information on CSV into the Canonical tables, that are refered in the documentation (the same you refer to, just a few paragraphs earlier).



Once you have the info in form of SAS cannonical tables and you have clear what is your field to be used as keyId (primary key), SAS will extract the info from SAS metadata again in form of canonical tables, then will compare both tables, and then the macros will create a third version of canonical tables, that will have update, add and delete versions, for the diffs. And if this is clear, the last macro will actually run the update in the SAS metadata, taking the info from this last version with update, add and delete.



Super User

Have a look at SASHome/SASFoundation/9.4/samples/base/ This is the program for synchronizing a UNIX userbase (/etc/passwd and /etc/group files) with SAS metadata. In essence, you have to build the same tables that the first part of the program creates from the UNIX files, so you can then use them in the following compare and update steps.

Calcite | Level 5

Thanks Kurt,


I will try out this sample code.


For the csv with user information, is there a specific format or any specific columns required for SAS to consume the information?


Thanks again,


Super User

From the passwd and group files, I extract:

  • username
  • numeric user ID
  • user's full name
  • the office location
  • groupname
  • numeric group ID
  • usernames of group members

These are sufficient to populate the required fields for the sync.

User's full name, office and other information (title, phone number) is pulled from the gecos field in the passwd file.


For in-depth information, you can find the macro codes in SASHome/SASFoundation/9.4/sasautos.

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 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1 like
  • 3 in conversation