Comparing Macro vs standard program real and cpu run time values

Accepted Solution Solved
Reply
Contributor
Posts: 32
Accepted Solution

Comparing Macro vs standard program real and cpu run time values

I have a question concerning the real time and cpu times I am getting when running two versions of the same program: the original version (Standard) without macro variables and  a "macro-ized" version in which a single macro variable is specified to introduce the dependent variable names in a PROC REG . The macro-ized version runs faster in terms of both real and cpu times than just Standard version.

If I understand how the SAS process works for a standard program it holds the submitted program in memory in the Input Stack, then tokenizes and then compiles and executes while the macro-ized version of the code has an additional step i.e. the Macro processor involved prior to compilation, execution and output. Can anyone out there explain this?

I've attached a log file to show what I'm talking about.

Attachment

Accepted Solutions
Solution
‎06-28-2014 09:10 PM
Respected Advisor
Posts: 4,173

Re: Comparing Macro vs standard program real and cpu run time values

The time it takes to tokenize/compile a program is neglectable. The CPU and real times you're getting are also in both cases for execution of the Procedures so at a time when the macro variable has already been resolved.

One possible reason for the different times could be disk-caching so the second time you process the same data it's much faster read into SAS.

For testing purposes: You could first run the macro var version and then the standard version and compare the result with what you've posted.

View solution in original post


All Replies
Solution
‎06-28-2014 09:10 PM
Respected Advisor
Posts: 4,173

Re: Comparing Macro vs standard program real and cpu run time values

The time it takes to tokenize/compile a program is neglectable. The CPU and real times you're getting are also in both cases for execution of the Procedures so at a time when the macro variable has already been resolved.

One possible reason for the different times could be disk-caching so the second time you process the same data it's much faster read into SAS.

For testing purposes: You could first run the macro var version and then the standard version and compare the result with what you've posted.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 148 views
  • 0 likes
  • 2 in conversation