tags:

views:

67

answers:

4

What is the uniqueness and advantage of SAS MACROs over SAS procedures? If macro's purpose is to reduce the effort to repeat tasks for different inputs, can't this be done by written as procedures too?

+3  A: 

It's kind of like asking why do we have Perl, Python, ksh, bash, etc. when we have all the programs that are available in UNIX. Macros are the scripting language that gives users a great deal of flexibility and control over what they want SAS to do. You can easily generate dynamic code as well. Existing procs are fairly rigid in what they can take as input and what you get as output. Proc FCMP has opened up the data step to user defined functions, but this is still no substitute for the flexibility that you get with the macro language.

cmjohns
+1 for mentioning that SAS Macro code can write code dynamically. This in my mind is the main reason for writing macros.
Rob Penridge
+1  A: 

SAS users do have the ability to create their own SAS PROC's. They have to license SAS/Toolkit and code in C or in some other languages.

SAS has many different parts. Macro is (or used to be) the most (and probably the only) universal tool in SAS that can put (almost any but not every) parts together. Given how primitive and strange the macro (language) is, this is a bit funny but true.

Chang Chung
Thanks for the reminder about SAS/Toolkit - I had forgotten about that product.
cmjohns