DATA Step, Macro, Functions and more

sas compilation and execution

Not applicable
Posts: 0

sas compilation and execution

Is it possible to compile the sas code separately and execute it at later time?

we usually running the sas code in this stage, itself the code gets complied and executed we gets the output if the code is correct. instead of that compile the code separately and excute that compiled code lately is it possibe?
Posts: 9,367

Re: sas compilation and execution

Posted in reply to deleted_user
SAS code does not compile into a traditional "load" module (like a COBOL program -- where you compile the code and then call the load module). There are several ways to store SAS code so it can be compiled and/or executed at a later time:

1) Macro programs
Putting your code in a macro program can work in different ways to delay the compile phase, depending on whether you use session-compiled macros, autocall macros or stored compiled macro programs

2) Stored Compiled DATA step programs:

3) Using SAS Stored Processes (within the context of the SAS Enterprise Intelligence Platform)
A SAS Stored Process runs within a very specific configuration on a special kind of SAS server, but the fundamental concept is that you store code in a special repository and the code will be compiled and executed when needed, based on the kind of code you submitted.

4) EG projects -- although an EG project is a collection of tasks, there is code underlying those tasks. Once the project has been developed and the code resides in an EG project, then the code in the project can be re-executed, without user intervention or additional development -- if that is the model you choose. Or the project can be changed and rerun.

As I said in the beginning, the kind of SAS programs that most people run fall into the "compile and go" category of code -- where the code is compiled before it executes. You can delay this process using the techniques above. In addition, if you are working on z/OS (the mainframe), there is a SAS/C Compiler and a SAS/C++ development system for the mainframe:

Depending on what you want to do it may be that SAS Macro processing is the place to start. There are many good books on how SAS Macro programs work and the macro documentation is excellent. You can also consult with Tech Support for more help figuring out the best method to achieve your task.

Not applicable
Posts: 0

Re: sas compilation and execution

Posted in reply to deleted_user
Simple answer = yes.

Should you?
Probably not.

SAS code can be pre-compiled and stored within the SAS system.

There is an advantage to this only if you have a sophisticated application written in SAS where the performance/throughput/response_time is critical and it really would help to eliminate compile time overhead. Otherwise, stored pre-compiled modules buys you little to no advantage.

Also, the use of macros can cause you to not have the results that you think you will get.
Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation