/******************* URBAN INSTITUTE MACRO LIBRARY *********************
: mparam_is_no
Macro: Returns 1 if the macro parameter value is "No"
Description"n", "N", "nO", etc.)
(could be
: Function
Use
: Peter Tatian
Author
***********************************************************************/
mparam_is_no(
%macro /** Macro parameter value to test (must resolve to a single value) **/
param
);
/*************************** USAGE NOTES *****************************
:
SAMPLE CALLmparam_is_no( &quiet )
%*********************************************************************/
/*************************** UPDATE NOTES ****************************
*********************************************************************/
***** ***** ***** MACRO SET UP ***** ***** *****;
%
%local ;
***** ***** ***** ERROR CHECKS ***** ***** *****;
%
***** ***** ***** MACRO BODY ***** ***** *****;
%
%if %quote(%upcase((¶m))) = %quote((N)) or
%quote(%upcase((¶m))) = %quote((NO)) %then %do;
1
%end;%else %do;
0
%end;
***** ***** ***** CLEAN UP ***** ***** *****;
%
%mend mparam_is_no;
/************************ UNCOMMENT TO TEST ***************************
*options mprint symbolgen mlogic;
= n;
%let p %let result = %mparam_is_no( &p );
=&p result=&result;
%put p= No;
%let p %let result = %mparam_is_no( &p );
=&p result=&result;
%put p
= Not;
%let p %let result = %mparam_is_no( &p );
=&p result=&result;
%put p
= Y;
%let p %let result = %mparam_is_no( &p );
=&p result=&result;
%put p
= ;
%let p %let result = %mparam_is_no( &p );
=&p result=&result;
%put p/**********************************************************************/
Check if Marcro Parameter is No
Purpose: Returns 1 if the macro parameter value is “No” (could be “n”, “N”, “nO”, etc.)