<?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: create macro for password when connecting to db2 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319061#M69984</link>
    <description>&lt;P&gt;Do you mind sharing the code if possible? &amp;nbsp;I tried to google %window but it does not seem related. Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 14 Dec 2016 21:51:31 GMT</pubDate>
    <dc:creator>clear6690</dc:creator>
    <dc:date>2016-12-14T21:51:31Z</dc:date>
    <item>
      <title>create macro for password when connecting to db2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319044#M69975</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each SAS job, we start with running a login.sas file to connect to the server. A window will pop up for us to enter the user name and password. Please see the script below:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro login();&lt;BR /&gt;%let mynode=iw603e 6048;&lt;BR /&gt;options comamid=tcp remote=mynode;&lt;BR /&gt;signon user= _PROMPT_ password=_PROMPT_ ;&lt;BR /&gt;%let rm_server=mynode;&lt;BR /&gt;libname rwork slibref=work server=&amp;amp;rm_server;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%login;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Recently, there is a change for the SAS db2 connection script so that we need to update the user name and password everytime we run SAS:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to db2 (user=user123 password=pass1&lt;SPAN&gt;23&lt;/SPAN&gt; &amp;nbsp;database=AAAAAAAA);&lt;BR /&gt;create table &lt;SPAN&gt;table_abc&lt;/SPAN&gt; (compress=yes) as select* from connection to db2 (&lt;BR /&gt;select *&lt;BR /&gt;from ABC.table_abc&lt;BR /&gt;);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible that we can extract the same user name and password from what we entered when running the login.sas file to update in the second piece of code?&amp;nbsp;I can use &amp;amp;sysuserid. for the user name but how about the password?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 20:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319044#M69975</guid>
      <dc:creator>clear6690</dc:creator>
      <dc:date>2016-12-14T20:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: create macro for password when connecting to db2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319059#M69983</link>
      <description>&lt;P&gt;Can you prompt the user once, using a %window for example, and then use the&amp;nbsp;credentials for both the signon and the db2 connection?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 21:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319059#M69983</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-12-14T21:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: create macro for password when connecting to db2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319061#M69984</link>
      <description>&lt;P&gt;Do you mind sharing the code if possible? &amp;nbsp;I tried to google %window but it does not seem related. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 21:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319061#M69984</guid>
      <dc:creator>clear6690</dc:creator>
      <dc:date>2016-12-14T21:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: create macro for password when connecting to db2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319065#M69987</link>
      <description>&lt;P&gt;try searching for :&amp;nbsp; sas %window&lt;/P&gt;
&lt;P&gt;you'll find many links, such as &lt;A href="http://www2.sas.com/proceedings/sugi27/p192-27.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi27/p192-27.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 22:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319065#M69987</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-12-14T22:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: create macro for password when connecting to db2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319324#M70103</link>
      <description>&lt;P&gt;Thank you ChrisNZ. I tried the &amp;amp;window statement and now I can create macro for both of user ID and Passoword.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only issue occurs we run monthly batch every month, which contains multiple SAS jobs. In the old way, the system signon only requires one-time input of user name and password and the window won't pop up for the next SAS job because we already signed in. However, with the &amp;amp;window statement, the window will pop up everytime when the next SAS job is running, and it won't continue if no one presses ENTER. Is there a way to solve this issue?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 17:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319324#M70103</guid>
      <dc:creator>clear6690</dc:creator>
      <dc:date>2016-12-15T17:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: create macro for password when connecting to db2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319393#M70140</link>
      <description>&lt;P&gt;You could check whether the variables exist and have a length before calling %window.&lt;/P&gt;
&lt;P&gt;See the %length() and %symexist() functions.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 21:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-for-password-when-connecting-to-db2/m-p/319393#M70140</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-12-15T21:17:15Z</dc:date>
    </item>
  </channel>
</rss>

