<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759348#M239965</link>
    <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;, excellent! As input, username and loginid are all unique. We can setup username="first name lastname loginid". I will follow your instructions to try the approach...thanks&lt;/P&gt;</description>
    <pubDate>Wed, 04 Aug 2021 14:30:13 GMT</pubDate>
    <dc:creator>Tom2021</dc:creator>
    <dc:date>2021-08-04T14:30:13Z</dc:date>
    <item>
      <title>Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759057#M239796</link>
      <description>&lt;P&gt;Could you provide advice and sample code?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a sas macro like&amp;nbsp;%macro m_createoneuser(username, loginid) to create a new user account with 2 input values: one user name, the user login id only to be called in base sas command line to integrate into Automation of Ansible. The loginid will be in DefaultAuth. Do not use sas management console to create user in GUI; do not import information from active directory or unix or ldap system. thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 15:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759057#M239796</guid>
      <dc:creator>Tom2021</dc:creator>
      <dc:date>2021-08-03T15:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759134#M239830</link>
      <description>&lt;P&gt;Doing what you ask involves using the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrmeta/titlepage.htm" target="_blank" rel="noopener"&gt;DATA step interface to SAS metadata&lt;/A&gt;. It means becoming familiar with SAS's metadata data model as well as the many functions in the DATA step interface. The coding is highly complex and comes with the added danger of corrupting your SAS metadata repository. I suggest you take the time to explore the documentation, particularly the code examples, as that will give you a good understanding of what is required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also what Groups and Roles will you allocate to the new user? Without these the new user won't be able to do anything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I think synchronising SAS user metadata with external security data sources is a lot easier as Groups are set up automatically.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 20:25:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759134#M239830</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-08-03T20:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759158#M239838</link>
      <description>Thank you SASkivi for your good advice. Coding with metadata is very complicated. This only asks two input values, maybe some simple code is available. I already have macro code to add user into groups from sas. Now I was testing approach in sas bulkload sample code to create new user, coding is easier, but failed to setup defaultauth. I will further test it...thanks...&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Aug 2021 22:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759158#M239838</guid>
      <dc:creator>Tom2021</dc:creator>
      <dc:date>2021-08-03T22:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759227#M239879</link>
      <description>&lt;P&gt;I can't post full code, contains lots of things not necessary to solve your problem.&lt;/P&gt;
&lt;P&gt;Step 1 Get the URI of DefaultAuth:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  rc = metadata_getnobj("omsobj:AuthenticationDomain?AuthenticationDomain[@Name = 'DefaultAuth']", 1, UriDefaultAuth);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;rc should be exactly 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2 Create person, assuming that username is unique, if it is not replacing it with loginid is recommended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rc = metadata_newobj('Person', UriPerson, "&amp;amp;username");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step 3 Setting some attributes, i am using the value for UsageVersion for some time, you can check the value using metabrowse in display manager or by using metadata_getattr on a user created with sas management console.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      rc = metadata_setattr(UriPerson, 'PublicType', 'User');
      rc = metadata_setattr(UriPerson, 'UsageVersion', '1000000');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step 4 The Login-object&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call missing(UriLogin);
/* not sure, if you need to use username or loginid in the next line */
rc = metadata_newobj("Login", UriLogin, "Login.&amp;amp;username", 'Foundation', UriPerson, "Logins");
rc = metadata_setattr(UriLogin, "UserID", "&amp;amp;loginID.");
rc = metadata_setassn(UriLogin, 'Domain', 'Append', UriDefaultAuth);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Having a recent backup the metadata is highly recommended &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 07:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759227#M239879</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-08-04T07:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759255#M239898</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391744"&gt;@Tom2021&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really need to get into more complex tasks analyzing and especially changing metadata that significantly exceeds what comes already ootb then consider to investigate what &lt;A href="https://www.metacoda.com/en/metacoda-plug-ins/" target="_self"&gt;Metacoda&lt;/A&gt; has to offer. I believe they also offer consulting services so depending on how big your company is and how stable and production-worthy things need to be, getting in contact with some real subject matter experts might be worth the time and cost.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NB: I only know about Metacoda's reputation but I won't profit in any way whatever you do so this is a honest recommendation without any hidden agenda.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 09:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759255#M239898</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-08-04T09:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759348#M239965</link>
      <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;, excellent! As input, username and loginid are all unique. We can setup username="first name lastname loginid". I will follow your instructions to try the approach...thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 14:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759348#M239965</guid>
      <dc:creator>Tom2021</dc:creator>
      <dc:date>2021-08-04T14:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759350#M239966</link>
      <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;. The service is good. Currently we do not have complex tasks for the service. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 14:33:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759350#M239966</guid>
      <dc:creator>Tom2021</dc:creator>
      <dc:date>2021-08-04T14:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759749#M240156</link>
      <description>&lt;P&gt;Hi, Andrea &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;I got error at step 2. after running, I can see the account was created but blank at tab accounts. no userid and DefaultAuth. could you help? thanks.&lt;/P&gt;&lt;P&gt;102 %mm_create_a_user(username8, loginid8);&lt;/P&gt;&lt;P&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/P&gt;&lt;P&gt;102:124 102:92 102:152 102:156 102:189 102:35 102:78 102:152 102:228 102:12&lt;/P&gt;&lt;P&gt;NOTE: Variable UriDefaultAuth is uninitialized.&lt;/P&gt;&lt;P&gt;NOTE: Variable UriPerson is uninitialized.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 16:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759749#M240156</guid>
      <dc:creator>Tom2021</dc:creator>
      <dc:date>2021-08-05T16:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759773#M240165</link>
      <description>&lt;P&gt;HI, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;I changed the line to&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_getnobj(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"AuthenticationDomain?@Name='DefaultAuth'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#08726d"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;, UriDefaultAuth);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;failed at the line&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_newobj("Login", UriLogin, "Login.&amp;amp;username", 'Foundation', UriPerson, "Logins");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;The 2 Uri becomes blank. Could you help me? thanks!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 17:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759773#M240165</guid>
      <dc:creator>Tom2021</dc:creator>
      <dc:date>2021-08-05T17:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Advice and sample to create a macro to create a new user(username, user loginid in DefaultAuth)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759801#M240182</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;&amp;nbsp;very much! Your sample code helped me and it is working properly now. Below is the full code. I will add error handling later. You know metadata functions very well. thanks again.&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mm_create_a_user(username, loginid);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;length UriPerson UriDefaultAuth UriLogin $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#08726d"&gt;256&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;call missing (UriPerson, UriDefaultAuth, UriLogin);&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_getnobj(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"AuthenticationDomain?@Name='DefaultAuth'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#08726d"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;, UriDefaultAuth);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_newobj(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'Person'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, UriPerson, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"&amp;amp;username"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_setattr(UriPerson, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'PublicType'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'User'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_setattr(UriPerson, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'UsageVersion'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'1000000'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_newobj(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"Login"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, UriLogin, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"&amp;amp;loginid"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'Foundation'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, UriPerson, &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_setattr(UriLogin, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"UserID"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"&amp;amp;loginid"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = metadata_setassn(UriLogin, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'Domain'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'Append'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, UriDefaultAuth);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mm_create_a_user;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 20:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Advice-and-sample-to-create-a-macro-to-create-a-new-user/m-p/759801#M240182</guid>
      <dc:creator>Tom2021</dc:creator>
      <dc:date>2021-08-05T20:37:02Z</dc:date>
    </item>
  </channel>
</rss>

