BookmarkSubscribeRSS Feed
anujsri
Calcite | Level 5

Hi,

 

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 (http://support.sas.com/documentation/cdl/en/bisecag/63082/HTML/default/viewer.htm#p03uv2agudmy9cn1kn...) 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.

 

Thanks,

Anuj

 

4 REPLIES 4
JuanS_OCS
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). 

 

https://documentation.sas.com/?docsetId=bisecag&docsetTarget=p1o31lg0trorn8n1rketxxe1jbr1.htm&docset...

 

 

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.

 

 

Kurt_Bremser
Super User

Have a look at SASHome/SASFoundation/9.4/samples/base/importpw.sas. 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.

anujsri
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,

Anuj

Kurt_Bremser
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 

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
  • 4 replies
  • 1535 views
  • 1 like
  • 3 in conversation