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 (April 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 29 Apr 2008 13:09:56 -0400
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <schreier.junk.mail@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <schreier.junk.mail@GMAIL.COM>
Subject:   Re: Subtracting Values in a Single Column
Content-Type:   text/plain; charset=ISO-8859-1

On Tue, 29 Apr 2008 09:00:22 -0400, wcw2 <wcw2@CDC.GOV> wrote:

>Subtracting Values in a Single Column > >Hello fun-seekers...I want to *groan* subtract the AUC values of DRUG B - >DRUG A and DRUG C - DRUG A and so on (for x # of drugs) BY PATIENT, to >produce the output on the right (B-A and C-A), in order to do a signed rank >test on the differences. I was thinking about sorting by patient, then >drug, and then using the DIF function. Would this work? Or, if there’s an >easier way (other than rearranging the whole dataset), I’d so much >appreciate any help......many thanks! > > >Patient Drug AUC B-A C-A >1 A 10 30 90 >2 A 20 40 100 >3 A 30 50 80 >1 B 40 >2 B 60 -> -> >3 B 80 >1 C 100 >2 C 120 >3 C 150

Here's a way which does not require hard-coding the names of the non-A drugs:

proc sql; create table diffs as select a.patient , cats(other.drug,'-A') as pair , other.auc - a.auc as diff from (select * from auc where drug EQ 'A') as a join (select * from auc where drug NE 'A') as other on a.patient = other.patient order by patient, pair; quit;


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