Lazy Evaluation: A Comparative Analysis of SAS MACROs and R Functions
Chen Ling, Yachen Wang

TL;DR
This paper compares lazy evaluation mechanisms in SAS MACROs and R functions, highlighting their differences and implications for programming efficiency, especially relevant as industries shift from SAS to R.
Contribution
It provides a detailed analysis of lazy evaluation strategies in SAS and R, illustrating their impact on code performance and offering guidance for optimization.
Findings
R uses Promise objects for deferred evaluation
SAS employs symbol tables for lazy evaluation
Differences affect code efficiency and behavior
Abstract
Lazy evaluation is a powerful technique that can optimize code execution by deferring evaluations until their results are required, thus enhancing efficiency. In most modern programming languages, like R, lazy evaluation is commonly applied to function arguments. However, the application of lazy evaluation in SAS has not been extensively explored. This paper focuses on the mechanisms of lazy evaluation in SAS MACROs and R functions, offering a comparative analysis of the underlying principles that drive these processes. R's lazy evaluation is driven by a data structure called Promise, which postpones evaluation and does not occupy memory until the value is needed, utilizing a call-by-need strategy. SAS, on the other hand, achieves lazy evaluation through its symbol tables, employing memory to store parameters, and operates on a call-by-name basis. These discrepancies in lazy…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSAS software applications and methods · Mathematics, Computing, and Information Processing · Data Analysis with R
