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
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.
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.
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.
Can you please help me to add a Group for a secured library datasets programatically?
Your help will be really helpful for me.
I got the GRPMEMS table after running the %mduextr macro and inside that I got grpkeyID and MemkeyID. If I add a new row suppose in that table with a unique grpkeyID and MemkeyID will it be update the meatdata?
I am just wondering how I will find the unique key for new Group and besides to GRPMEMS table what other tables need to be updated.
Please help if possible. Thank in advance.
I found a solution to this.
./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
You can check the link. I think it's safe to do, because I tried and it's working.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
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.