How to compile Macro into a physical directory? Whenever SAS is open, the macro is there to run?!
Also to encrypt it; to make it "unreadable" even with OPION MPRINT...
Thanks
When compiling a macro you can add the option SECURE on the %MACRO statement. Documentation indicates you should not store passwords or code segments, use for entire Proc or Data step. The STORE option lets you specify a specific library and catalog location for the compiled result. Use the system option SASMSTORE= to specify a permanent location. You will need to have the system option MSTORED to use the macro. Read the options of the %MACRO statement in the documentation.
Caveat: code compiled in a macro code is specific to OS and version. Catalogs created in SAS 9.3 are not usable by 9.4 and may have issues with the incremental releases.
Do not lose track of the source code or you will not be able to recover the code. We have had that question asked a few times on the forum.
When compiling a macro you can add the option SECURE on the %MACRO statement. Documentation indicates you should not store passwords or code segments, use for entire Proc or Data step. The STORE option lets you specify a specific library and catalog location for the compiled result. Use the system option SASMSTORE= to specify a permanent location. You will need to have the system option MSTORED to use the macro. Read the options of the %MACRO statement in the documentation.
Caveat: code compiled in a macro code is specific to OS and version. Catalogs created in SAS 9.3 are not usable by 9.4 and may have issues with the incremental releases.
Do not lose track of the source code or you will not be able to recover the code. We have had that question asked a few times on the forum.
Thanks.
I run the SAS DOC codes below. It is fine.
But one quest: options mstored sasmstore=mylib; tells SAS to find Macro in mylib; DOES that mean work.sasmacr is not working then?!
options mstored sasmstore=mylib;
libname mylib "C:\Users\24891\sas";
%macro secure/store secure; /* This macro is encrypted */
data _null_;
x=1;
put "This data step was generated from a secure macro.";
run;
%mend secure;
%secure;
filename maccat catalog 'mylib.sasmacr.secure.macro';
data _null_;
infile maccat;
input;
list;
run;
I suggest you read the documentation on this subject. Once the SASMSTORE option is set. All macros compiled afterwards will be stored in that location. If you already have macros in WORK.SASMACR then those should continue to work.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.