As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Difference between revisions of "Tips:Now You Can Use the IN Operator in a Macro"

From sasCommunity
Jump to: navigation, search
(promoted to Tip Ready)
(Scheduled July 7, 2015)
Line 29: Line 29:
 
<!-- Please do not edit below this line, EXCEPT when promoting a tip -->
 
<!-- Please do not edit below this line, EXCEPT when promoting a tip -->
 
<div style="float:right">Submitted By [[User:Otterm1|Mary Rosenbloom]] ([[User talk:Otterm1|talk]])</div>
 
<div style="float:right">Submitted By [[User:Otterm1|Mary Rosenbloom]] ([[User talk:Otterm1|talk]])</div>
[[Category:Tip Ready]]
+
[[Category:Tip in Use]]

Revision as of 23:09, 12 May 2015

Starting in SAS 9.2, you can use the IN operator inside of a macro.

options minoperator;
%macro putme(name=)/mindelimiter=',';
	%if %lowcase(&name) in alice,alfred,barbara %then %put &name is in the list;
	   %else %put name is NOT in the list;
%mend;
 
%putme(name=Alice)
%putme(name=Buddy)

The user must specify both the MINOPERATOR global option, the MINDELIMITER local option within the macro definition, and the delimiter for the MINDELIMETER option.

....see also

Submitted By Mary Rosenbloom (talk)