BookmarkSubscribeRSS Feed
hellohere
Pyrite | Level 9

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, 

9 REPLIES 9
hellohere
Pyrite | Level 9

Also anyway to require a passwd to run a macro?! If passwd does not match, write into log(encrypted, not-directly-readable)?!

Quentin
Super User

@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 ; 

 

japelin
Rhodochrosite | Level 12

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;
yabwon
Amethyst | Level 16

You could try the GSM (Generate Secure Macros) package:

https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/gsm.md

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



hellohere
Pyrite | Level 9
How to download and install the package?!
yabwon
Amethyst | Level 16

Hi,

 

Start with reading Readme.md here:

https://github.com/yabwon/SAS_PACKAGES

 

Then you can check out this presentation:

https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Getting_Started_with_SAS_Packages...

 

and eventually watch the recording from BASUG meetup:

https://www.basug.org/videos?wix-vod-video-id=78067e61413d43d3a6951974b3bc3014&wix-vod-comp-id=comp-...

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Tom
Super User Tom
Super User

What possible justification is there for hiding the source code for something that you are going to let people run?

ballardw
Super User

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.

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 1877 views
  • 3 likes
  • 7 in conversation