<?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 Conditional assigmnent in appserver_autoexec_usermods in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501625#M14561</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following line of code in the&amp;nbsp;E:\SAS\Config\Lev1\SASApp\appserver_autoexec_usermods.sas file which is used to assign macro search and format libraries&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\HPO\MACROS") FMTSEARCH=(WORK FORMATS APFMTLIB);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine and the formats are accessible from EG.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I would like to assign these searches&amp;nbsp; conditionally based on the userid and I tried the code below. The code works fine if I run it directly in EG but when I have it in&amp;nbsp;&lt;SPAN&gt;E:\SAS\Config\Lev1\SASApp\appserver_autoexec_usermods.sas the formats are not accessible.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is all on the workspace server rather than stored process. Within EG it looks as though the conditions to make the assignments as per the %else %if are being met but not in the autoexec. Is there somewhere I can view the log to see what is happening here? Is there a fundamental reason why this wouldn't work?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any Help welcome. Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro setfmt();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%if %upcase(&amp;amp;_clientuserid)='USER1' or %upcase(&amp;amp;_clientuserid)='USER2' %then %do;&lt;/P&gt;&lt;P&gt;options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\QID\QID_MAC") FMTSEARCH=(WORK QID_FMT APFMTLIB);&lt;BR /&gt;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%else %do;&lt;/P&gt;&lt;P&gt;options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\HPO\MACROS") FMTSEARCH=(WORK FORMATS APFMTLIB);&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%setfmt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Oct 2018 17:54:06 GMT</pubDate>
    <dc:creator>Fiachra</dc:creator>
    <dc:date>2018-10-04T17:54:06Z</dc:date>
    <item>
      <title>Conditional assigmnent in appserver_autoexec_usermods</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501625#M14561</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following line of code in the&amp;nbsp;E:\SAS\Config\Lev1\SASApp\appserver_autoexec_usermods.sas file which is used to assign macro search and format libraries&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\HPO\MACROS") FMTSEARCH=(WORK FORMATS APFMTLIB);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine and the formats are accessible from EG.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I would like to assign these searches&amp;nbsp; conditionally based on the userid and I tried the code below. The code works fine if I run it directly in EG but when I have it in&amp;nbsp;&lt;SPAN&gt;E:\SAS\Config\Lev1\SASApp\appserver_autoexec_usermods.sas the formats are not accessible.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is all on the workspace server rather than stored process. Within EG it looks as though the conditions to make the assignments as per the %else %if are being met but not in the autoexec. Is there somewhere I can view the log to see what is happening here? Is there a fundamental reason why this wouldn't work?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any Help welcome. Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro setfmt();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%if %upcase(&amp;amp;_clientuserid)='USER1' or %upcase(&amp;amp;_clientuserid)='USER2' %then %do;&lt;/P&gt;&lt;P&gt;options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\QID\QID_MAC") FMTSEARCH=(WORK QID_FMT APFMTLIB);&lt;BR /&gt;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%else %do;&lt;/P&gt;&lt;P&gt;options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\HPO\MACROS") FMTSEARCH=(WORK FORMATS APFMTLIB);&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%setfmt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 17:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501625#M14561</guid>
      <dc:creator>Fiachra</dc:creator>
      <dc:date>2018-10-04T17:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional assigmnent in appserver_autoexec_usermods</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501639#M14562</link>
      <description>Here, and so probably also at your site, _CLIENTUSERID is set to, e.g. 'USER1' in EG, but to USER1 (no quotes) in SAS Studio.  Seems like an odd inconsistency, but there it is.  Different ways of starting a session may result in yet another way the value is set.&lt;BR /&gt;Will &amp;amp;SYSUSERID. instead of _CLIENTUSERID work for you?  I think it will if you're not running on the Stored Process Server, but I haven't tried it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501639#M14562</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2018-10-04T18:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional assigmnent in appserver_autoexec_usermods</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501649#M14563</link>
      <description>&lt;P&gt;Hi Jack,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion. I tried removing the quotes but it didn't make any difference. At the moment I am trying to get the default branch to work i.e. the %else %if piece which is the one relevant to my own account&amp;nbsp; (neither USER1 or USER2) so I would have thought the code would be executed&amp;nbsp;with or without the quotes. Seems not to be the case though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just tried replacing the first conditional statement with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%if 1=2 or 2=3 %then %do;&lt;/P&gt;&lt;P&gt;options......&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the assignment works fine so the issue is with the initial if statement which seems to be returning&amp;nbsp; true&amp;nbsp;even though neither of the users specified is me.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:45:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501649#M14563</guid>
      <dc:creator>Fiachra</dc:creator>
      <dc:date>2018-10-04T18:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional assigmnent in appserver_autoexec_usermods</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501692#M14567</link>
      <description>&lt;P&gt;You need to use&amp;nbsp;&amp;amp;sysuserid not &amp;amp;_CLIENTUSERID in server autoexecs as&amp;nbsp;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;_CLIENTUSERID is an EG only addition.&amp;nbsp;&amp;amp;sysuserid is your user account without quotes so your macro logic should not include quotes.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 21:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501692#M14567</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-10-04T21:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional assigmnent in appserver_autoexec_usermods</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501717#M14569</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;You need to use&amp;nbsp;&amp;amp;sysuserid&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just be careful about token authentication. In some environments %sysuserid might resolve to &lt;EM&gt;sassrv&lt;/EM&gt; for everyone.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 01:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501717#M14569</guid>
      <dc:creator>SimonDawson</dc:creator>
      <dc:date>2018-10-05T01:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional assigmnent in appserver_autoexec_usermods</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501771#M14574</link>
      <description>&lt;P&gt;Hey Folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;just a &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11650"&gt;@SimonDawson&lt;/a&gt;&amp;nbsp;mentioned you have to be aware of the Token Authentication. &lt;BR /&gt;I just had to prepare the environment for different Application Server Context in the same Installation. &lt;BR /&gt;The solution was a site - specific autoexec which is included in the autoexec_usermods of the Application Server Context which will&amp;nbsp; need it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my case i could work with the token user, so i first check the existence of the &amp;amp;SYSUSERID variable...&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro appsercontext_XYZ / des='Macro for assign options per application server context XYZ';
    %if %symexist(SYSUSERID) %then
        %do;
            %*Identify the SYSUSERID for the application server context;
            %if %index(%upcase(&amp;amp;SYSUSERID),&amp;lt;inser token user&amp;gt;) %then
                %do;
                    /*Options block*/
                    options nosource;
                    options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\QID\QID_MAC") FMTSEARCH=(WORK QID_FMT APFMTLIB);
                    options source;
                %end;
        %end;
    %else %do;
        /*Options block*/
        options nosource;
        options compress=yes MAUTOSOURCE SASAUTOS=("E:\SASData\HPO\MACROS") FMTSEARCH=(WORK FORMATS APFMTLIB);
        options source;
    %end;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards, &lt;BR /&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 08:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501771#M14574</guid>
      <dc:creator>AndreasWindisch</dc:creator>
      <dc:date>2018-10-05T08:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional assigmnent in appserver_autoexec_usermods</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501810#M14575</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the very useful suggestions. Using &amp;amp;sasuserid has solved my issue and the correct paths and libraries are now being set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fiachra&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 10:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Conditional-assigmnent-in-appserver-autoexec-usermods/m-p/501810#M14575</guid>
      <dc:creator>Fiachra</dc:creator>
      <dc:date>2018-10-05T10:07:49Z</dc:date>
    </item>
  </channel>
</rss>

