Usage Note 31322: Using NOT in conjunction with the IN operator for the Macro facility
The IN mnemonic operator is a binary comparison operator that compares the value of the operand on the left side of the equal sign against the list of values in the operand on the right side. A value of 1 is returned if a match is found in the right hand operand, a 0 is returned otherwise. In order to negate the returned value, use the NOT operator. The NOT operator must precede the syntax so that the opposite value is returned. For example:
CODE:
%let list=1 2 3;
%macro test(comp) / minoperator;
%if not(&comp in &list) %then %put &comp is not in list;
%else %put &comp is in list;
%mend test;
%test(4)
LOG results:
7 %let list=1 2 3;
8 %macro test(comp) / minoperator;
9 %if not(&comp in &list) %then %put &comp is not in list;
10 %else %put &comp is in list;
11 %mend test;
12 %test(4)
4 is not in list
Operating System and Release Information
SAS System | Base SAS | Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
z/OS | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
Microsoft Windows 2000 Server | 9.2 TS1M0 | |
Microsoft Windows 2000 Professional | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows 2000 Advanced Server | 9.2 TS1M0 | |
Microsoft Windows 2000 Datacenter Server | 9.2 TS1M0 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
The NOT operator is used to negate the returned value of the IN operator.
Type: | Usage Note |
Priority: | |
Topic: | SAS Reference ==> Macro
|
Date Modified: | 2013-05-07 10:32:09 |
Date Created: | 2008-02-28 09:16:09 |