<?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: Macro for encryption --error on execution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370861#M275773</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13717"&gt;@Mushtaq&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I believe you can't encrypt datasets in WORK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Running your code sample against a permanent library works for me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname test 'c:\temp';

data test.salary(encrypt=aes encryptkey=green12345);
  set sashelp.air;
run;

proc  contents data=test.salary(encryptkey=green12345);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9896iDE49B56CE7C19F83/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I personally would create a AES encrypted secured metadata bound library using SAS Management Console.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you've created such a library only SAS users having metadata access to this metadata library definition will be able to read the data - but all data created in this library will be AES encrypted without the user having to care about it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2017 10:14:42 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-06-27T10:14:42Z</dc:date>
    <item>
      <title>Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370443#M275765</link>
      <description>&lt;P&gt;Can you help me to find the problem. Macro compiles but exection is throwing error in log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;%macro encryptsas(libpath,metalib, metafolder);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;proc authlib lib="&amp;amp;libpath";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt; create securedlibrary="&amp;amp;metalib" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt; securedfolder="&amp;amp;metafolder" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt; pw=test123&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt; require_encryption=yes&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt; encrypt=AES&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt; encryptkey=testkeyvalue123;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;%mend encryptsas;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;quit;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%encryptsas (/var/usersdata/risk/prj/users/awais/projects/hello, Secured, Awais);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt; "/var/usersdata/risk/prj/users/awais/projects/hello&lt;/FONT&gt;&lt;BR /&gt; &lt;FONT color="#FF0000"&gt;___________________________________________________&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; 22&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt; 200&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR 22-322: Expecting a name. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 07:44:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370443#M275765</guid>
      <dc:creator>Mushtaq</dc:creator>
      <dc:date>2017-06-26T07:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370447#M275766</link>
      <description>&lt;P&gt;Lib= means a library reference to a network drive area. &amp;nbsp;You can't put the network drive in there. &amp;nbsp;So create a libname, then use that, e.g:&lt;/P&gt;
&lt;PRE&gt;%macro encryptsas(libpath,metalib, metafolder);

  libname tmp "&amp;amp;libpath.";
  proc authlib lib=tmp;
    create securedlibrary="&amp;amp;metalib." 
    securedfolder="&amp;amp;metafolder." 
    pw=test123
    require_encryption=yes
    encrypt=AES
    encryptkey=testkeyvalue123;
  run;

%mend encryptsas;
 

%encryptsas (/var/usersdata/risk/prj/users/awais/projects/hello, Secured, Awais);&lt;/PRE&gt;
&lt;P&gt;Do note I made a few&amp;nbsp;corrections.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 07:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370447#M275766</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T07:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370448#M275767</link>
      <description>&lt;P&gt;Thank you for quick response. But I would like to use libame statement outside te macro, so I can have felxiblity of &amp;nbsp;using diffrent libarary names as a parameter &amp;nbsp;while executing the macro --considring to to add the macro in autocall .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 08:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370448#M275767</guid>
      <dc:creator>Mushtaq</dc:creator>
      <dc:date>2017-06-26T08:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370452#M275768</link>
      <description>&lt;P&gt;Then you should supply the libname (and not the path) to the macro and use the macro variable that now holds the libname without quotes.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 08:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370452#M275768</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-26T08:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370454#M275769</link>
      <description>&lt;P&gt;Simple change then:&lt;/P&gt;
&lt;PRE&gt;%macro encryptsas(libpath=,metalib=,metafolder=);

  proc authlib lib=&amp;amp;libpath.;
    create securedlibrary="&amp;amp;metalib." 
    securedfolder="&amp;amp;metafolder." 
    pw=test123
    require_encryption=yes
    encrypt=AES
    encryptkey=testkeyvalue123;
  run;

%mend encryptsas;
 
libname tmp "/var/usersdata/risk/prj/users/awais/projects/hello";
%encryptsas (libpath=tmp, metalib=secured, metafolder=wais);&lt;/PRE&gt;
&lt;P&gt;You will of course then want to put in parameter validation on the three parameters - e.g. make sure library exists etc. &amp;nbsp;This would all be part of your lifecycle management documentaion and validation on the code. &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 08:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370454#M275769</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-26T08:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370840#M275770</link>
      <description>&lt;P&gt;Thank you&amp;nbsp; for the updated sas code. It works but there is&amp;nbsp; problem&lt;/P&gt;
&lt;P&gt;looks like data set does not get encrypted when&amp;nbsp;&lt;/P&gt;
&lt;P&gt;we provide libname statemnet&amp;nbsp;outside the&amp;nbsp; the Macro&amp;nbsp;. Proc contenet does not show any encrption.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tmp.test24;&lt;BR /&gt;&amp;nbsp; set sashelp.air;&lt;BR /&gt;&amp;nbsp; run;&lt;BR /&gt;&lt;FONT color="#ff0000"&gt;proc contents data=tmp.test24;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#ff0000"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG title="Proc contents.JPG" alt="Proc contents.JPG" src="https://communities.sas.com/t5/image/serverpage/image-id/9892i692A65F844FBDA78/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;
&lt;P&gt;I do have sas/secure&amp;nbsp; licensed and installed.&amp;nbsp; Here is&amp;nbsp;the proc content and &amp;nbsp;output of another simple program&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data salary(encrypt=aes encryptkey=green12345);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.air;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;proc&amp;nbsp; contents data=work.salary(encryptkey=green12345);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13992iCBC6F7BF23AF2271/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Salary dataset contents.JPG" title="Salary dataset contents.JPG" /&gt;</description>
      <pubDate>Tue, 27 Jun 2017 08:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370840#M275770</guid>
      <dc:creator>Mushtaq</dc:creator>
      <dc:date>2017-06-27T08:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370841#M275771</link>
      <description>&lt;P&gt;Thank you&amp;nbsp; for the updated sas code. It works but there is&amp;nbsp; problem&lt;/P&gt;
&lt;P&gt;looks like data set does not get encrypted when&amp;nbsp;&lt;/P&gt;
&lt;P&gt;we provide libname statemnet&amp;nbsp;outside the&amp;nbsp; the Macro&amp;nbsp;. Proc contenet does not show any encrption.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tmp.test24;&lt;BR /&gt;&amp;nbsp; set sashelp.air;&lt;BR /&gt;&amp;nbsp; run;&lt;BR /&gt;&lt;FONT color="#ff0000"&gt;proc contents data=tmp.test24;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#ff0000"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG title="Proc contents.JPG" alt="Proc contents.JPG" src="https://communities.sas.com/t5/image/serverpage/image-id/9892i692A65F844FBDA78/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;
&lt;P&gt;I do have sas/secure&amp;nbsp; licensed and installed.&amp;nbsp; Here is&amp;nbsp;the proc content and &amp;nbsp;output of another simple program&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data salary(encrypt=aes encryptkey=green12345);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.air;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;proc&amp;nbsp; contents data=work.salary(encryptkey=green12345);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13993iCBCAFD4EAAF56CD5/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Salary dataset contents.JPG" title="Salary dataset contents.JPG" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13994i2F6C74850CD8DE45/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Salary dataset contents.JPG" title="Salary dataset contents.JPG" /&gt;</description>
      <pubDate>Tue, 27 Jun 2017 08:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370841#M275771</guid>
      <dc:creator>Mushtaq</dc:creator>
      <dc:date>2017-06-27T08:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370852#M275772</link>
      <description>&lt;P&gt;Sorry, its not making any sense, you post that this code is not doing what you expect:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data tmp.test24;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But this code is doing what you expect:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data salary(encrypt=aes encryptkey=green12345);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But the two are clearly very different lines of code?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Secondly the macro given, all this does is create the given Base SAS code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;libname tmp "/var/usersdata/risk/prj/users/awais/projects/hello";&lt;BR /&gt;proc authlib lib=tmp; &lt;BR /&gt;  create securedlibrary="secured" &lt;BR /&gt;  securedfolder="wais" &lt;BR /&gt;  pw=test123 &lt;BR /&gt;  require_encryption=yes &lt;BR /&gt;  encrypt=AES &lt;BR /&gt;  encryptkey=testkeyvalue123; &lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;If the above doesn't give what you want, its probably best to speak with SAS support as I don't know enough about this proc authlib versus the datastep version you give, or anything about your setup.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 09:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370852#M275772</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-27T09:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370861#M275773</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13717"&gt;@Mushtaq&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I believe you can't encrypt datasets in WORK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Running your code sample against a permanent library works for me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname test 'c:\temp';

data test.salary(encrypt=aes encryptkey=green12345);
  set sashelp.air;
run;

proc  contents data=test.salary(encryptkey=green12345);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9896iDE49B56CE7C19F83/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I personally would create a AES encrypted secured metadata bound library using SAS Management Console.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you've created such a library only SAS users having metadata access to this metadata library definition will be able to read the data - but all data created in this library will be AES encrypted without the user having to care about it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 10:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370861#M275773</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-06-27T10:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370877#M275774</link>
      <description>&lt;P&gt;Are you sure all your codes run in the same context?&lt;/P&gt;
&lt;P&gt;When doing this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname seclib '$HOME/seclib';

proc authlib;
create
  library=seclib
  securedlibrary = "seclib"
  encrypt = aes
  encryptkey=XYZ
  require_encryption=yes
  pw=mypass
;
run;

data seclib.class;
set sashelp.class;
run;

proc contents data=seclib.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;seclib.class was automatically encrypted.&lt;/P&gt;
&lt;P&gt;Note that $HOME/seclib was newly created and therefore empty.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 12:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/370877#M275774</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-27T12:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for encryption --error on execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/371122#M275775</link>
      <description>&lt;P&gt;Thank you all who replied and I updated the macro and it works. But inspite I have secured library folder crated using SMC, and there are &lt;FONT color="#FF0000"&gt;no errors/warnings &amp;nbsp;during compliation and execution of the macro, &amp;nbsp;&lt;/FONT&gt;the data set creted is not enrypted --as reported by proc contents. &amp;nbsp;Here is the code &amp;nbsp;again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro encryptsas(libpath=,metalib=,metafolder=);

  proc authlib lib=&amp;amp;libpath.;
    create securedlibrary="&amp;amp;metalib." 
    securedfolder="&amp;amp;metafolder." 
    pw=test123
    require_encryption=yes
    encrypt=AES
    encryptkey=testkeyvalue123;
  run;

%mend encryptsas;
 
libname tmp "/var/usersdata/risk/prj/users/awais/projects/hello";
%encryptsas (libpath=tmp, metalib=secured, metafolder=awais);

data tmp.test25;
 set sashelp.air;
 run;
proc contents data=tmp.test25;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9907i7B1E687607ACBDF7/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="proc contents" title="proc contents" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 02:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-encryption-error-on-execution/m-p/371122#M275775</guid>
      <dc:creator>Mushtaq</dc:creator>
      <dc:date>2017-06-28T02:18:47Z</dc:date>
    </item>
  </channel>
</rss>

