BookmarkSubscribeRSS Feed
Fluorite | Level 6



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





SAS Employee



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


SAS® 9.4 Language Interfaces to Metadata -> METADATA_SETASSN Function


Here is a description of type "Group": SAS(R) 9.4 Metadata Model: Reference -> Group

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.

Data never sleeps
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.
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.



Opal | Level 21

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.

Pyrite | Level 9









Opal | Level 21

@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.

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.

Opal | Level 21

@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 

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
  • 9 replies
  • 6 in conversation