1

I am trying a similar approach to add new sas users to sas metadata and assigning them the existing groups in sas metadata. Do you have to pass the object reference values in %mm_adduser2group(user="",group="") macro provided in the GitHub link. Passing the object values would be but of a strech considering we would have to fetch the values from sas application. Instead could passing the normal values work for the macro Eg -(user="xyz",group=sasstudio""). We were facing issues while assigning new users to existing group using this macro. Any suggestions on how can I resolve this issue

Reference question :- adding a meta user to a meta group in sas

GitHub link for Macro - https://github.com/sasjs/core/blob/main/meta/mm_adduser2group.sas

Allan Bowe
  • 12,306
  • 19
  • 75
  • 124

1 Answers1

0

The values to the macro should be passed unquoted, eg:

    %mm_adduser2group(user=xyz,group=sasstudio)

You say:

We were facing issues while assigning new users to existing group using this macro. Any suggestions on how can I resolve this issue

However you don't actually say what the issue was. Does it work when you add users to groups manually using SAS Management Console? Perhaps the users are already in those groups, or have an inherited membership to those groups?

Allan Bowe
  • 12,306
  • 19
  • 75
  • 124
  • We are facing the below warning while executing the macro Error- NOTE: Writing HTML5(EGHTML) Body file: EGHTML 27 28 %mm_adduser2group(user=sasdemo, group=Test_Group) NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds WARNING: SYSCC=3000, exiting MM_ADDUSER2GROUP We also trying running the macro for user already existing in the group but received the same error Also we tried passing object reference values for %mm_adduser2group to overcome the WARNING: SYSCC=3000(Syntax error) – Sarvesh Bhogale Jul 29 '20 at 14:25
  • You don't have a clean session (syscc=3000). The macro has a safety feature to prevent execution if the session is in error state. Try resetting your session (or provide an earlier warning / error message) – Allan Bowe Jul 30 '20 at 00:40
  • Facing this below error even though the user is present in SAS Metdata – Sarvesh Bhogale Jul 30 '20 at 19:18
  • filename mc url "https://raw.githubusercontent.com/Boemska/macrocore/master/macrocore.sas"; %inc mc; 6570 6571 /* add a user to a group */ 6572 %mm_adduser2group(user=Sarvesh Bhogale, group=ETL) WARNING: rc=-1 Sarvesh Bhogale not found , or there was an error reading the repository. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds WARNING: rc=-1 Sarvesh Bhogale not found , or there was an error reading the repository. ERROR: Errors printed on page 1. – Sarvesh Bhogale Jul 30 '20 at 19:20
  • Do we have to mention the repository anywhere in the code. Because the user Sarvesh Bhogale is present in the Metadata/Repository in SAS management console. %mm_adduser2group(user=Sarvesh Bhogale, group=ETL) – Sarvesh Bhogale Jul 31 '20 at 13:19
  • Below Code to add user in metadata do the Metadata variables have to be passed manually in the code or in the start of defining the macro filename __us2grp temp; proc metadata in= "$METAREPOSITORY SAS268435456" out=__us2grp verbose; run; – Sarvesh Bhogale Jul 31 '20 at 14:53
  • use `options metaserver` to ensure you are in the right repository. Also, make sure you are actually connected to the metadata server. – Allan Bowe Aug 02 '20 at 22:45
  • I was able to add the user to already exiting groups using this macro in SAS Guide. But when i try to do the same on SAS server i am getting below error WARNING: rc=-1 Sarvesh Bhogale not found , or there was an err reading the repository. Do i need to add the macro in any specific location.I could see the below location /opt/sas9.4/sashome/SASFoundation/9.4/sasautos on server. I did add the macro here but when i run it i am seeing the same error. Can you help here please. – Sarvesh Bhogale Aug 25 '20 at 13:51
  • try `options metarepository=foundation;` (my previous comment incorrectly mentioned metaserver). The macro, as you say, does work - for some reason your session is configured differently between your "server" sas instance and however your EG sessoin is configured. If you're running a "raw" sas instance, you will also need to connect to metadata first (options metaserver / metauser / metapass) – Allan Bowe Aug 25 '20 at 21:12