Need run code on a server, for security concerns, do not like anyone to see the SAS code.
How to save MACRO encrypted and unviewable to anyone?! Thanks,
Also anyway to require a passwd to run a macro?! If passwd does not match, write into log(encrypted, not-directly-readable)?!
@hellohere wrote:
Also anyway to require a passwd to run a macro?! If passwd does not match, write into log(encrypted, not-directly-readable)?!
It would be a hack, but I suppose you could have a password= parameter.
Then in the macro definition, something like:
%if &password ne SecretPassword %then %do ;
%put ERROR: incorrect password, macro exiting ;
%return ;
%end ;
First, the macro code is stored encrypted by specifying the /store secure option to the macro.
Also, specify options such as nosource nosource2 nomlogic nosymbolgen nomprint when executing the macro. Prevent sas code from being output to the log.
This will keep the sas code secret.
libname macout 'C:\temp';
options mstored sasmstore=macout;
%Macro samplemacro /STORE SECURE;
options nosource nosource2 nomlogic nosymbolgen nomprint;
/* describe your code below */
%Mend;
You could try the GSM (Generate Secure Macros) package:
https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/gsm.md
All the best
Bart
Hi,
Start with reading Readme.md here:
https://github.com/yabwon/SAS_PACKAGES
Then you can check out this presentation:
and eventually watch the recording from BASUG meetup:
All the best
Bart
What possible justification is there for hiding the source code for something that you are going to let people run?
Large economy sized hint: What ever approach you use make 100% sure that you have the code saved, backed up, documented where that source is kept, and in multiple places.
We have seen several requests on this forum for "recovering the code" from a "secured" macro because they need to modify it. But the original code has been lost/moved/moved to Texas or similar. The typical approaches won't allow code recovery so the user years later is left unsupported.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.