Posted By

webonomic on 10/13/12



Versions (?)

Default Macro Values

 / Published in: SAS


Quite often it is necessary to set a default value for a macro parameter that is passed to a program. If the program is a macro, the %IF statement can be used to check if the value is provided and provide a default value if not. Since %IF statements are not allowed outside of macros, that technique won't work for a non-macro program (e.g., a file/program that is %INCLUDEd). The following code snippet demonstrates the use of the COALESCEC function to assign a default value.

since macro is a text manipulation facility, the coalesceC function is used regardless of whether the expected value for the parameter is numeric (i.e., everything in macro is interpretted as a character string).

Report this snippet  

You need to login to post a comment.