Getting the IN operator to FUNCTION inside a SAS Macro
By: Perry Watts
Recommended Reading:
http://www.nesug.org/Proceedings/nesug09/cc/cc05.pdf
http://www.lexjansen.com/cgi-bin/xsl_transform.php?x=tmac&s=nesug_t&c=nesug
Related Link:
http://www.pinggu.org/bbs/thread-690356-1-1.html
By: bobguy
/* ---------------------------------------------------------------------------
Program : inFcn.sas
Author : Perry Watts
Date : 10Jun2009 14:39
Project : N09 Coder's Corner
Title : CC05: Getting the IN operator to FUNCTION inside a SAS® Macro
Path : Referenced in the SASAUTOS option in the CALLING program.
Purpose : Use inFcn to replicate the IN operator inside a macro.
Notes : Positional Keywords are being used to mimic operands assigned to
the IN operator.
------------------------------------------------------------------------ */
%macro InFcn (excerpt, matchlist);
%local TorF quotes;
%let quotes=%str(%'%");
%let excerpt = %nrbquote(%sysfunc(compress(&excerpt,""es")));
%let matchlist = %sysfunc(translate(&matchList,' ', ','));
%let matchlist = %nrbquote(%sysfunc(compress(&matchList,""es")));
%let TorF = %SYSFUNC(indexW(%upcase(&matchlist), %upcase(&excerpt)));
&TorF
%mend InFcn;


雷达卡


京公网安备 11010802022788号







