<?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: Encrypt / password protect sas codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/955221#M373067</link>
    <description>&lt;P&gt;You can save it as a macro and include the STORE and SECURE option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you trying to prevent people from running the code without your permission, taking credit for your code, or editing the code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jan 2025 15:28:17 GMT</pubDate>
    <dc:creator>coder1234</dc:creator>
    <dc:date>2025-01-06T15:28:17Z</dc:date>
    <item>
      <title>Encrypt / password protect sas codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/775663#M246573</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We are trying to encrypt SAS codes, can someone guide on how can we password protect / encrypt the SAS codes?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 14:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/775663#M246573</guid>
      <dc:creator>devi001</dc:creator>
      <dc:date>2021-10-21T14:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Encrypt / password protect sas codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/775666#M246575</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since SAS programs are text files, you cannot protect by&amp;nbsp;password directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The alternatives that come to mind quickly are&lt;BR /&gt;1. create a password protected zip file&lt;BR /&gt;You can use 7za or similar to do this on the command line, so I think it is possible to have it done from sas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. make sas program dataset&lt;BR /&gt;The sas dataset can be password protected and encrypted, so you can use that.&lt;BR /&gt;This can be done in the following way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* sas program to encrypted sas dataset */
filename enc 'c:\temp\encrypt_test.sas';
data enc(read=abc write=def alter=ghi encrypt=yes);
  infile enc;
  length prg $200;
  input;
  prg=_infile_;
run;

/* sas dataset to sas program */
filename dec 'c:\temp\decrypt_test.sas';
data _null_;
  set enc(read=abc);
  file dec;
  BLANK = verify(prg," ")-1;
  put +BLANK prg;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Oct 2021 01:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/775666#M246575</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-10-22T01:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Encrypt / password protect sas codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/775743#M246600</link>
      <description>&lt;P&gt;Why do you want to do this? SAS programs have to be unencrypted to be executed.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 20:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/775743#M246600</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-10-21T20:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Encrypt / password protect sas codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/955221#M373067</link>
      <description>&lt;P&gt;You can save it as a macro and include the STORE and SECURE option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you trying to prevent people from running the code without your permission, taking credit for your code, or editing the code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 15:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/955221#M373067</guid>
      <dc:creator>coder1234</dc:creator>
      <dc:date>2025-01-06T15:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Encrypt / password protect sas codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/955227#M373070</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/403304"&gt;@devi001&lt;/a&gt;! While you cannot password-protect your raw code file since it is just text, you can store and compile DATA Step programs with the Source option to save the source code with it. If you use the &lt;EM&gt;source=encrypt&lt;/EM&gt; and&amp;nbsp;&lt;EM&gt;pw&lt;/EM&gt; options, you can&amp;nbsp;save and encrypt the source code, then retrieve it later. For more information, see: &lt;A href="https://go.documentation.sas.com/doc/en/lrcon/9.4/p0td6cbpqq6xgjn10qfh5vr9vfl2.htm" target="_self"&gt;Creating A Stored Compiled DATA Step Program&lt;/A&gt;.&amp;nbsp;The next best option would be to save all of your programs into an encrypted ZIP file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, this will create a DATA Step program and save it to sasuser as&amp;nbsp;&lt;EM&gt;foo_compiled.sas7bpgm&lt;/EM&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data foo / pgm=sasuser.foo_compiled(source=encrypt pw=mypw);
    bar = 'Hello, World!';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you attempt to view the program source without a password, you will get an error:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pgm=sasuser.foo_compiled;
    describe;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;ERROR: Invalid or missing ALTER password on member SASUSER.FOO_COMPILED.PROGRAM.
ERROR: Unable to load DATA STEP program SASUSER.FOO_COMPILED.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Supplying the password will reveal the source code in the log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pgm=sasuser.foo_compiled(pw=mypw);
    describe;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;NOTE: DATA step stored program SASUSER.FOO_COMPILED is defined as:

data foo / pgm=sasuser.foo_compiled(source=encrypt pw=XXXX);
   bar = 'Hello, World!';
run;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To call a stored compiled program and run it, simply omit&amp;nbsp;the&amp;nbsp;&lt;EM&gt;describe&lt;/EM&gt; statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pgm=sasuser.foo_compiled(pw=mypw);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 18:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Encrypt-password-protect-sas-codes/m-p/955227#M373070</guid>
      <dc:creator>Stu_SAS</dc:creator>
      <dc:date>2025-01-06T18:01:58Z</dc:date>
    </item>
  </channel>
</rss>

