<?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: Automating ODBC Connection in SAS Enterprise Guide Based on Logged On User in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automating-ODBC-Connection-in-SAS-Enterprise-Guide-Based-on/m-p/314228#M21210</link>
    <description>&lt;P&gt;What database are you connecting to? If it is SQL Server then you may be able to use Windows Authentication and avoid supplying a userid at all:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;connect to odbc as MyDataSrc&amp;nbsp;(required="dsn=MyODBC;Trusted_Connection=yes;")&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 25 Nov 2016 07:46:01 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2016-11-25T07:46:01Z</dc:date>
    <item>
      <title>Automating ODBC Connection in SAS Enterprise Guide Based on Logged On User</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automating-ODBC-Connection-in-SAS-Enterprise-Guide-Based-on/m-p/314204#M21208</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to automate my data sourcing based on who is logged on at the moment (providing the logged on user has proper access permission to the DB server). The MyODBC connection in the sample below is an ODBC connection setup in the computer, with windows active directory userid login is the only one required to connect to the server. No individual user password is required as it's all based on group policy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently using the following connection script in SAS program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%let MyDatasrc=connect to odbc as MyDataSrc (required="dsn=MyODBC;uid=myuserid");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;---------------------------------------------------------------------------------------------------------------------&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;amp;MyDataSrc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Create table MyData as&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Select * From Connection to MyDataSrc (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Select Field1, Field2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;From SANDPIT.dbo.MyData&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;disconnect from MyDataSrc;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;----------------------------------------------------------------------------------------&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I replace "&lt;FONT face="courier new,courier"&gt;myuserid&lt;/FONT&gt;" with something like &lt;FONT face="courier new,courier"&gt;&amp;amp;SYSUSERID&lt;/FONT&gt; system variable that get the user.&lt;/P&gt;&lt;P&gt;Seems like if I change the part that defines the odbc connection:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;(required="dsn=MyODBC;uid=myuserid")&lt;/FONT&gt;, SAS &lt;/SPAN&gt;won't accept it as a valid option&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Rianto&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2016 04:17:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automating-ODBC-Connection-in-SAS-Enterprise-Guide-Based-on/m-p/314204#M21208</guid>
      <dc:creator>rs73</dc:creator>
      <dc:date>2016-11-25T04:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Automating ODBC Connection in SAS Enterprise Guide Based on Logged On User</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automating-ODBC-Connection-in-SAS-Enterprise-Guide-Based-on/m-p/314228#M21210</link>
      <description>&lt;P&gt;What database are you connecting to? If it is SQL Server then you may be able to use Windows Authentication and avoid supplying a userid at all:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;connect to odbc as MyDataSrc&amp;nbsp;(required="dsn=MyODBC;Trusted_Connection=yes;")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Nov 2016 07:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automating-ODBC-Connection-in-SAS-Enterprise-Guide-Based-on/m-p/314228#M21210</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-11-25T07:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automating ODBC Connection in SAS Enterprise Guide Based on Logged On User</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automating-ODBC-Connection-in-SAS-Enterprise-Guide-Based-on/m-p/314682#M21230</link>
      <description>Yes, it is SQL server and Windows Authentication. I've tried it and it works!&lt;BR /&gt;&lt;BR /&gt;Thank's heaps...&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2016 00:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automating-ODBC-Connection-in-SAS-Enterprise-Guide-Based-on/m-p/314682#M21230</guid>
      <dc:creator>rs73</dc:creator>
      <dc:date>2016-11-28T00:10:57Z</dc:date>
    </item>
  </channel>
</rss>

