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 (September 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 18 Sep 2010 13:02:52 -0400
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: A data step question: comparison of values of multiple
              variables
Comments: To: Mike Rhoads <RHOADSM1@WESTAT.COM>

Mike,

I agree that it would be hard to get "much" simpler, but easy to get a little simpler. How about:

data UnequalValues; set sample; if range(of _:) ; run;

Art -------- On Fri, 17 Sep 2010 16:13:30 -0400, Mike Rhoads <RHOADSM1@WESTAT.COM> wrote:

>I received a private reply that contained the following improvement: > >if range(of _01-_09) ; > >Hard to get much simpler than that! > > >Mike > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Mike Rhoads >Sent: Friday, September 17, 2010 1:01 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: A data step question: comparison of values of multiple variables > >I'm getting to this thread belatedly, but how about simply: > >data UnequalValues; >set sample; >if min(of _01-_09) ^= max(of _01-_09); >run; > > >Mike Rhoads >RhoadsM1@Westat.com > > > > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Mike Zdeb >Sent: Wednesday, September 15, 2010 4:58 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: A data step question: comparison of values of multiple variables > >hi ... here's another idea >I think it should work with any similar data >:-) ... > > > >data sample; >infile cards missover; >input PATIENT_ID _01-_09; >cards; >001 8310 >002 3510 8310 >003 7500 >004 1010 >005 6910 8310 >006 . 8310 >007 0600 >008 2100 2100 >009 8000 8000 8000 >010 . 3500 >; >run; > >options missing = ''; > >data new; >set sample; >if verify(tranwrd( catx(' ', of _:) , cats(coalesce(of _:)) , '*' ), ' *' ); >run; > >options missing = '.'; > >proc print data=new noobs; >run; > >PATIENT_ > ID _01 _02 _03 _04 _05 _06 _07 _08 _09 > 2 3510 8310 . . . . . . . > 5 6910 8310 . . . . . . . > >-- >Mike Zdeb >U@Albany School of Public Health >One University Place (Room 119) >Rensselaer, New York 12144-3456 >P/518-402-6479 F/630-604-1475 > >> Hi there, >> I have a quesion about comparing values of multiple variables within an >> observation. >> >> Here's how my dataset looks like: >> PATIENT_ID _01 _02 _03 _04 _00 _05 _07 _60 _06 _08 _09 >> ----------------------------------------------------------------------- >> 001 8310 >> 002 3510 8310 >> 003 7500 >> 004 1010 >> 005 6910 8310 >> 006 8310 >> 007 0600 >> 008 2100 2100 >> 009 8000 8000 8000 >> 010 3500 >> >> Each observation has at least one non-missing value in variable _00 to >> _60. I want to identify observations that had unequal values in variable >> _00 to _60, such as PATIENT_ID 002 and 005 in the above sample dataset. >> >> I believe that there must be more than one easy and efficient way to do. >> Thanks for your help!! >>


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