<?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: Proc Export - Password in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825165#M325917</link>
    <description>&lt;P&gt;Is there a particular reason why you are creating really old 2002 format XLS spreadsheets? If you changed to using XLSX spreadsheets, SAS can produce these itself and then you wouldn't need to use the SAS PC Files Server and to supply user names and passwords.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Jul 2022 20:12:47 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2022-07-24T20:12:47Z</dc:date>
    <item>
      <title>Proc Export - Password</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/823475#M325147</link>
      <description>&lt;P&gt;my SAS runs on my organisation server. When i want to extract data in the organisation location in an Excel file i use the below :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export dbms=excelcs data=&amp;amp;&amp;amp;var&amp;amp;i.
       	outfile="&amp;amp;outpath.\&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;today..xls";
       	sheet=&amp;amp;&amp;amp;var&amp;amp;i.;
       	version="2002";                     
		server		= "organisationservername";
		port		= 8000;
		ServerUser = "compuk\&amp;amp;lwin";
	    ServerPass = "&amp;amp;pwin";                          
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the problem with the above code is that i have to provide my ServerPass which is my personal windows password. Since the code used by multiple users if i save it in the program file it will be visible to everyone. I saved the below in the Tools &amp;gt; options &amp;gt; SAS programs &amp;gt; Submit SAS code when server is connected&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/* Insert custom code after server connection here */
options symbolgen;

proc pwencode in='my personal password goes here' method=sas002;
run;
%let user_pass=&amp;amp;_pwencode.; 


*--------------------- End of User password setup ----------------;
proc sql noprint;
  select value into: user_id
   from sashelp.vmacro
where name="_CLIENTUSERID";
quit;
%let user_id=%sysfunc(dequote(&amp;amp;user_id.));
%let lwin=&amp;amp;user_id.;
%let pwin=&amp;amp;user_pass.;
&lt;/PRE&gt;
&lt;P&gt;but when i run Proc Export i receive the below error :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: Server is unable to authenticate user credentials. (missing or invalid SERVERUSER='&amp;lt;domain\username&amp;gt;'; 
       SERVERPASS='&amp;lt;password&amp;gt;'; enclosed in quotes).&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;i want to find a way to save somewhere my password and when i want to extract to Excel file SAS does not need to ask me to provide it&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 09:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/823475#M325147</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2022-07-15T09:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Export - Password</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825086#M325886</link>
      <description>&lt;P&gt;This is because the password encrypted by SAS is different from the password stored at the server level.&lt;BR /&gt;The solution depends upon the environment architecture.&amp;nbsp; Speak to the administrators.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jul 2022 16:21:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825086#M325886</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-07-23T16:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Export - Password</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825090#M325887</link>
      <description>&lt;P&gt;The issue of sharing code where a private password is needed is solved like this:&lt;/P&gt;
&lt;P&gt;Every user has a program file which sets the macro variables containing the credentials; the file is stored in the same location in each user's HOME, and the permissions are set so that only the user can read it.&lt;/P&gt;
&lt;P&gt;The shared programs will then contain this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include '$HOME/sas/password.sas`;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to fetch the credentials.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jul 2022 16:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825090#M325887</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-23T16:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Export - Password</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825159#M325915</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The issue of sharing code where a private password is needed is solved like this:&lt;/P&gt;
&lt;P&gt;Every user has a program file which sets the macro variables containing the credentials; the file is stored in the same location in each user's HOME, and the permissions are set so that only the user can read it.&lt;/P&gt;
&lt;P&gt;The shared programs will then contain this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include '$HOME/sas/password.sas`;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to fetch the credentials.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Or better still develop your own macro that reads from the text file so that no macro variable is needed.&amp;nbsp; You could use the MODE=3 method of this macro:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/fread.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/fread.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Place the file with the password into a folder like .ssh that only you can read.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ServerPass = "%read_password($HOME/.ssh/organisationservername.txt)"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 15:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825159#M325915</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-24T15:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Export - Password</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825165#M325917</link>
      <description>&lt;P&gt;Is there a particular reason why you are creating really old 2002 format XLS spreadsheets? If you changed to using XLSX spreadsheets, SAS can produce these itself and then you wouldn't need to use the SAS PC Files Server and to supply user names and passwords.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 20:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export-Password/m-p/825165#M325917</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-24T20:12:47Z</dc:date>
    </item>
  </channel>
</rss>

