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 (March 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 5 Mar 2002 14:49:09 -0500
Reply-To:     "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
Subject:      Re: creative solutions anyone?
Comments: To: "MNess@CROMEDICA.COM" <MNess@CROMEDICA.COM>
Content-Type: text/plain; charset="iso-8859-1"

Mathew,

(1) Reverse the order of sort from TRT PAR to PAR TRT. (2) Apply Da Whitlock loop.

proc sort data = mydata out = partrt ; by par trt ; run ;

data q (drop = trt count perc) ; array c (2) count1 count2 ; array p (2) perc1 perc2 ; do _n_ = 1 by 1 until (last.par) ; set partrt ; by par trt ; c(_n_) = count ; p(_n_) = perc ; end ; run ;

Kind Regards,

Venky #****************************************# # E-mail: venky.chakravarthy@pfizer.com # # Phone: (734) 622-1963 # #****************************************#

-----Original Message----- From: Matthew Ness [mailto:MNess@CROMEDICA.COM] Sent: Tuesday, March 05, 2002 2:45 PM To: SAS-L@LISTSERV.UGA.EDU Subject: creative solutions anyone?

Hi all, I'm just curious if there are any creative solutions to rearrange the following dataset:

data mydata; input trt par count perc; cards; 1 1 34 17 1 2 65 32.5 1 3 20 10 2 1 12 8 2 2 90 60 2 3 132 88 ;

to look like this:

par count1 perc1 count2 perc2 1 34 17 12 8 2 65 32.5 90 60 3 20 10 132 88

I've basically taken the approach of using datasteps to split mydata apart into two datasets (a trt group in each), rename count and perc, then merge the two datasets back together by par. I don't like this approach because there seems like there should be a more efficient way so I was wondering if anyone had any other angles of attack?

TIA, Matt


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