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 ; 

 

BASUG is hosting free webinars Next up: Mike Raithel presenting on validating data files on Wednesday July 17. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
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
Onyx | Level 15

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
Onyx | Level 15

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.

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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