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 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Mar 2009 12:25:13 -0700
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Transposing data question
Comments: To: Peter Flom <peterflomconsulting@mindspring.com>
In-Reply-To:  <11478561.1237489209150.JavaMail.root@mswamui-swiss.atl.sa.earthlink.net>
Content-Type: text/plain; charset=utf-8

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Peter Flom > Sent: Thursday, March 19, 2009 12:00 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Transposing data question > > Hello again > > I've got a data set that looks like > > Scanner ID Hand Gender Forearm PRV PDA > C 1 R M 1 63 0.288 > C 1 R M 2 60 0.285 > E 1 R M 1 59 0.298 > E 1 R M 2 61 0.291 > C 2 R M 1 52.8 0.243 > C 2 R M 2 72 0.293 > E 2 R M 1 72 0.298 > E 2 R M 2 75.6 0.258 > etc. > > I would like to run correlations for PRV when scanner = C vs PRV when scanner = > A; similar for PDA. > > I'm playing with the data step, but getting nowhere, and do not have time to do more > playing. > > Doubtless this is easy for a PROC TRANSPOSE or DATA step expert .... > > TIA > > Peter > > PS Note that I will be at this job for 2 hours, then back on Monday, but will check > my e-mail. I just won't be able to > try out any suggestions in-between > > Peter L. Flom, PhD > Statistical Consultant > www DOT peterflomconsulting DOT com

Peter,

Does this get you close to what you want?

data have; input Scanner $ ID Hand $ Gender $ Forearm PRV PDA; cards; C 1 R M 1 63 0.288 C 1 R M 2 60 0.285 E 1 R M 1 59 0.298 E 1 R M 2 61 0.291 C 2 R M 1 52.8 0.243 C 2 R M 2 72 0.293 E 2 R M 1 72 0.298 E 2 R M 2 75.6 0.258 C 3 R M 1 52.8 0.243 C 3 R M 2 72 0.293 E 3 R M 1 72 0.298 E 3 R M 2 75.6 0.258 ; run;

data want; merge have(where=(scanner='C') rename=(prv=prv_c pda=pda_c)) have(where=(Scanner='E') rename=(prv=prv_e pda=pda_e)) ; by id forearm; run;

Hope this is helpful,

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204


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