This article demystifies these interactions and explores how to use CASL variables for dynamic, data-driven programming, which is often more efficient than traditional macros.
1. Understanding the Architecture: Where Does Your Code Run?
2. CASL Variables: More Powerful Than Macro Variables
Unlike macro variables, which are just text, CASL uses dynamically typed variables (the type is defined upon assignment)5. The true power of CASL lies in its composite data types.
The modern and high-performance equivalent of macro loops (%DO %WHILE or loops on call execute) is the DO OVER loop in CASL. It allows for easy iteration over arrays, dictionaries, or result tables.
DO OVER Loop Syntax
For a Dictionary:DO , OVER ;
For an Array:DO OVER ;
For a Table: You iterate over the rows as if it were an array.
Table 3: Macro vs. CASL Comparison for Data-Driven Programming
Example of UDF logic:You can create a loadAllFiles(caslib) function that retrieves the list of files from a caslib and loops over them to automatically load them into memory, thus replacing dozens of lines of complex macro code.
Los códigos y ejemplos proporcionados en WeAreCAS.eu son con fines educativos. Es imperativo no copiarlos y pegarlos ciegamente en sus entornos de producción. El mejor enfoque es comprender la lógica antes de aplicarla. Recomendamos encarecidamente probar estos scripts en un entorno de prueba (Sandbox/Dev). WeAreCAS no acepta ninguna responsabilidad por cualquier impacto o pérdida de datos en sus sistemas.
SAS y todos los demás nombres de productos o servicios de SAS Institute Inc. son marcas registradas o marcas comerciales de SAS Institute Inc. en los EE. UU. y otros países. ® indica registro en los EE. UU. WeAreCAS es un sitio comunitario independiente y no está afiliado a SAS Institute Inc.
Este sitio utiliza cookies técnicas y analíticas para mejorar su experiencia.
Saber más.