LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 11 Jul 2005 17:26:34 -0400
Reply-To:     Ed Heaton <EdHeaton@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ed Heaton <EdHeaton@WESTAT.COM>
Subject:      Re: How to simplify a comparison -
Comments: To: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Content-Type: text/plain; charset="iso-8859-1"

Paul,

Consider the following.

Data _null_ ; Input a $ w $ ; Put (_all_)(=) @ ; If ( a eq w ne " " ) then put " are the same." ; Else put ; Cards4 ; 1 2 3 3 a w a a w w a . . w ;;;;

So,

if (a=w & a~='') or (b=x & b~='') or (c=y & c~='') or (d=z & d~='');

becomes

if (a=w~=' ') or (b=x~=' ') or (c=y~=' ') or (d=z~=' ') ;

I can't help much with

if (a=b|a=c) & a~='';

Ed

Edward Heaton, SAS Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1600 Research Boulevard, RW-3541, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 610-5128 mailto:EdHeaton@Westat.com http://www.Westat.com

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Choate, Paul@DDS Sent: Monday, July 11, 2005 1:07 PM To: SAS List (SAS-L@LISTSERV.UGA.EDU) Subject: How to simplify a comparison -

Good morning SAS aficionados -

I just posted some code to a thread that contains a headache I often have:

if (a=w & a~='') or (b=x & b~='') or (c=y & c~='') or (d=z & d~='');

or similarly:

if (a=b|a=c) & a~='';

The issue is that I want to check for non-missing equivalence between two (or more) variables simultaneously. Any comments on how one might simplify this?

tia

Paul Choate DDS Data Extraction (916) 654-2160


Back to: Top of message | Previous page | Main SAS-L page