Date: Wed, 15 Sep 2010 16:57:51 -0400
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: A data step question: comparison of values of multiple
variables
Content-Type: text/plain;charset=iso-8859-1
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!!
>