BookmarkSubscribeRSS Feed
SSA1
Fluorite | Level 6

Hi,

 

How to create SAS User Group in SMC (9.4) - Programmatically. 

 

Thanks,

Sakthi

 

9 REPLIES 9
alexal
SAS Employee

@SSA1,

 

Check these documents, you have to use a combination of METADATA_NEWOBJ & METADATA_SETASSN functions.

 

SAS® 9.4 Language Interfaces to Metadata -> METADATA_NEWOBJ Function
https://go.documentation.sas.com/?docsetId=lrmeta&docsetTarget=p0ckrfx4pm9pj7n1x3x4e9ddx4cw.htm&docs...

 

SAS® 9.4 Language Interfaces to Metadata -> METADATA_SETASSN Function
https://go.documentation.sas.com/?docsetId=lrmeta&docsetTarget=p1pt2ddn2xhmaen1p5whdq58ithh.htm&docs...

 

Here is a description of type "Group": SAS(R) 9.4 Metadata Model: Reference -> Group
https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#group.htm

LinusH
Tourmaline | Level 20

What is your use case?

Sometimes it's better wit a data driven approach. Then you could use the %mdu-family of macros, which uses a canonical data model as interface.

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

Data never sleeps
SimonDawson
SAS Employee
@LinusH mentioned the %mdu* macros.
This is likely going to be the simplest method.

Run %mduextr to extract the current metadata users and groups into canonical tables. Make your modifications to the groups you want in those tables. Then load it back in.
3.
rajdeep
Pyrite | Level 9

Hi Simon,

 

Hope you are doing great.

 

I also wanted to add a specific group for a secured library datasets. I have already created the secure library successfully.

 

I also ran %mduextr(libref=MD1);

 

I also got N number of canonical tables, now I am just confused in which of those canonical tables I need to add the specific group.

 

Like, I need to run an insert into query for any one of that canonical table or what exactly should be taken care of I just wanted to know. Can you please help me if possible taking out few moments of your time!

 

Because I also want to know suppose I am able to add the group at one point of time, but after that can we give the permissions of read,write or execute programmatically ?? Or for permissions we need to touch the SMC to do that manually!!

 

Your help will be really appreciated.

 

Thanks....

SASKiwi
PROC Star

I would recommend backing up your metadata before you do any changes programmatically, just in case something goes wrong. Is this a learning exercise or is it something you will continue to do regularly? I would only see this as a worthwhile approach if you need to do a lot of metadata changes.

rajdeep
Pyrite | Level 9

Hi 

 

 

 

 

 

 

 

SASKiwi
PROC Star

@rajdeep - This is not a straightforward process and it takes hours of development and careful testing. If this is a one-off requirement then just do it manually. It is a lot safer and quicker this way.

rajdeep
Pyrite | Level 9

 

 

 

./sas-set-metadata-access -profile "Admin" "/MBL Actual" -grant sas:Read,Write,ReadMetadata,WriteMetadata

./sas-set-metadata-access -profile "Admin" "/System/Secured Libraries/MBL" -grant sas:Read,Write,ReadMetadata,WriteMetadata

 

Batch Tool: sas-set-metadata-access

 

You can check the link. I think it's safe to do, because I tried and it's working.

SASKiwi
PROC Star

@rajdeep - Good to see you found a way of doing this. For the level of maintenance we do in metadata I still find SAS Management Console the most efficient way of making changes.

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
  • 9 replies
  • 2393 views
  • 8 likes
  • 6 in conversation