<?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 How to switch users in a SAS session in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657807#M197152</link>
    <description>&lt;P&gt;Hi There, I would like to switch profiles (User id) to run parts of code in a single sas session on SAS EG. Any help. Many thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2020 02:13:51 GMT</pubDate>
    <dc:creator>RaSha</dc:creator>
    <dc:date>2020-06-12T02:13:51Z</dc:date>
    <item>
      <title>How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657807#M197152</link>
      <description>&lt;P&gt;Hi There, I would like to switch profiles (User id) to run parts of code in a single sas session on SAS EG. Any help. Many thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 02:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657807#M197152</guid>
      <dc:creator>RaSha</dc:creator>
      <dc:date>2020-06-12T02:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657882#M197164</link>
      <description>&lt;P&gt;That isn't possible as you are tied to the userid used in your EG profile to create your SAS session. Switching userids means switching EG profiles and starting a new SAS session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you want to switch userids?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 04:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657882#M197164</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-06-12T04:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657946#M197179</link>
      <description>Thanks for your reply, part of my code needs to be run from one id and do the processing. Later, output files of this code needs to be transferred to another server using the separate ID.&lt;BR /&gt;&lt;BR /&gt;I am ok to switch profiles in an EG session as the output files from the first part of code will be permanently saved, do you know a way to switch profiles via code.&lt;BR /&gt;&lt;BR /&gt;Many thanks</description>
      <pubDate>Fri, 12 Jun 2020 07:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657946#M197179</guid>
      <dc:creator>RaSha</dc:creator>
      <dc:date>2020-06-12T07:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657963#M197185</link>
      <description>&lt;P&gt;The only option I can think of is to run the piece of code as a batch job on the server, something like:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;call system('runas /user:domainname\username sas.exe -sysin pgm.sas');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&lt;FONT face="courier new,courier"&gt;call system('&lt;/FONT&gt;net use \\svr\shre /USER:usr pwd     &amp;amp;    \\svr\shre\saspgm.cmd');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Having a password in plain text is &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;very&lt;/STRONG&gt; &lt;/FONT&gt;bad practice however.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 08:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/657963#M197185</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-12T08:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658073#M197215</link>
      <description>&lt;P&gt;You say that you need the separate ID for file transfer only. How do you transfer the files?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658073#M197215</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-12T14:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658224#M197269</link>
      <description>##- Please type your reply above this line. No attachments. -&lt;BR /&gt;&lt;BR /&gt;Thanks for your reply..&lt;BR /&gt;&lt;BR /&gt;We use sftp protocol and SSH keys for that</description>
      <pubDate>Fri, 12 Jun 2020 23:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658224#M197269</guid>
      <dc:creator>RaSha</dc:creator>
      <dc:date>2020-06-12T23:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658229#M197273</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323587"&gt;@RaSha&lt;/a&gt;&amp;nbsp;- throwing ideas here. Not sure what will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Solution options&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&amp;nbsp;If you Google with something like&amp;nbsp;&lt;EM&gt;linux run command as another user&lt;/EM&gt; then you'll get quite a few hits. You're user has most likely no elevated privileges which allow to issue &lt;EM&gt;sudo&lt;/EM&gt; commands but from browsing through some of the discussions it appears an admin could allow your user to &lt;EM&gt;sudo&lt;/EM&gt; a specific command or script so that you can &lt;A href="https://learning.oreilly.com/library/view/linux-security-cookbook/0596003919/ch05s03.html" target="_self"&gt;execute as another user&lt;/A&gt;. You would need to talk to a linux admin at your site and explain what you need.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&amp;nbsp;"You" could add the script transferring the file to a scheduler which gets triggered whenever a file arrives in a specific folder. You then just execute your first step creating the file in EG and write the output to this folder. I would assume that that the schedule/batch user has elevated rights and can execute the transfer process under the user you need.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&amp;nbsp;If you need to go for something where you have user/pw in the code then you could at least have this in a secure compiled macro in the &lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n1she0gfz2wh4sn1c8fwaeajjc4r.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;SAS mstore&lt;/A&gt; - and you then keep the source code in a safe place.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;D&lt;/STRONG&gt; Or ideally do what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;proposes if that's possible for your user&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jun 2020 02:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658229#M197273</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-14T02:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch users in a SAS session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658240#M197277</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323587"&gt;@RaSha&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;##- Please type your reply above this line. No attachments. -&lt;BR /&gt;&lt;BR /&gt;Thanks for your reply..&lt;BR /&gt;&lt;BR /&gt;We use sftp protocol and SSH keys for that&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then you do not need to switch users before running the sftp command. In the ~/.ssh/config file, you can specify connection parameters for each target host, including which user-ID to use.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jun 2020 04:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-switch-users-in-a-SAS-session/m-p/658240#M197277</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-13T04:04:19Z</dc:date>
    </item>
  </channel>
</rss>

