DATA Step, Macro, Functions and more

Add User Programatically

Posts: 66

Add User Programatically

Hi All,
I want to set up a program (as a stored process) that will allow people in my company to be registered as a user via a web form. On the public kiosk of our portal I have a url portlet pointing to a home page. I have a form on this page where a user requests access and then an admin adds the user and the user to groups and channels. I want to automate this part by following the below process.

1. User goes to our portal
2. User requests access adding;
a. Network Username
b. Full Name
c. Role
d. Department
e. Manager
f. Contact Number
g. Email
h. Groups they want access to (currently drawn from our metadata server)

3. User is added with the following details created;
a. User Full Name
b. Department added to the Description Field
c. Username added to logins with authentication domain as 'Default Auth'
d. Email & Phone added
e. Role,Department,Manager added as custom attributes
f. User assigned to the group 'Environ Users'

4. Email sent to both user and Admin notifying them they have been added.

What I am looking for is a code snippet that shows me how I can programatically;
a. Add a user to our metadata server
b. Assign a login with DefaultAuth
c. Add a description
d. Add phone and email
e. Add custom attributes.
f. Assign user to a group

Any help is appreciated

Super Contributor
Posts: 474

Re: Add User Programatically

Everything you pointed is possible through the Open Metadata Interface, of course with the right authorization level.

Not an easy task though.

You'll have to code your needs into the correct XML request.

Check the online publishing, everything is in there (at least the important facts):

SAS 9.1.3 Open Metadata Interface User's Guide:

Cheers from Portugal.

Daniel Santos @
Posts: 0

Re: Add User Programatically

It does involve some legwork, but it's far from impossible. Please back everythng up, and be 100% sure it works properly before putting it live though. I take no responsibility for any future problems you may have ;-)

Firstly, do you understand the basics of navigating around the underlying metadata? If not read this first (Sorry to blow my own trumpet)

First you'll need to identify all of the appropriate objects and associations (I'd suggest you start with the 'Person' object, and have a dig around from there. You should get an understanding of all of the new objects you'll need to create and the existing ones you'll need to link to your new user (the authentication domain for example)

Now you just need to set up your XML request. Here's a very crude request, just to highlight the basic principles ............

filename inXML temp ;
data _null_ ;
file inXML lrecl=2500 ;
"" /
" " /
" " / /* Create a new job, with a new id (note the $ tells us to create a new id */
" " /
" " / /* Put the new job under an existing tree */
" /
" /
" " /
" " / /* Create a new transformation Activity */
" " /
" " / /* Assosciate this TA with the 'new' job defined above */
" /
" /
" " /
" /
" &reposid" /
" SAS" /
" 268435456" /
" /
run ;

proc metadata in = inXML ;
run ;

Hope this all makes sense for you


Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation