DATA Step, Macro, Functions and more

Running SAS code as a black box

New Contributor
Posts: 3

Running SAS code as a black box



I need to run a sas code without having the access to open it and read its contents. Basically, there's this code that has been written by some other team, and they do not want to reveal the logic to any other team. And I need to refer to this code for my purpose. Hence, was wondering if it is possible to treat this other team's code as a black box, wherein I can simply refer to this code's location, feed my dataset as input, and receive the output data with the variable of interest added. Is this possible in SAS? If so, how so? 


Thanks a lot

Super User
Posts: 23,776

Re: Running SAS code as a black box

Store the code as a macro with the secure and nosource option. 


See the documentation under %macro for an example, Example 5.

Super User
Super User
Posts: 9,599

Re: Running SAS code as a black box

Yes, this is a common problem in our industry.  What I will say is this, try your hardest not to do this.  I will give you an example of why not to do this.  Recently SAS upgraded their infrastructure to be 64bit.  What this means is that 32bit catalogs - compiled libraries or macros etc. no longer work with the SAS version.  This is a really big problem as it means everything done by our vendors prior to that now no longer works for us, and because it is closed source we cannot fix it, nor can we go back to the original developers as this was some years back.


It is a very bad idea to progress along that path and I can't say this enough,just don't do it.  For our vendors now we filter out any who cannot provide full program source, even if this means we have to pay more than normal to get macros developed just for us.  Closed source is archaic over protection, and will cause you problems at some point.

Valued Guide
Posts: 505

Re: Running SAS code as a black box


Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation