|
transpose questionKristi,
While I'm not familiar with proc transpose, and I'm sure my colleagues could
offer a more sophisticated solution, the following might accomplish what you
need:
Art
---------------
Assuming you open your current file as one, then:
data twoa;
set one;
if label eq 'Atrial Prematurities';
AtrHist=onsetdt;
AtrDt=histyn;
keep ptid AtrHist AtrDt;
run;
data twob;
set one;
if label eq 'Angina';
AngHist=onsetdt;
AngDt=histyn;
keep ptid AngHist AngDt;
run;
data twoc;
set one;
if label eq 'Hypertension';
HypHist=onsetdt;
HypDt=histyn;
keep ptid HypHist HypDt;
run;
proc sort data=twoa;
by ptid;
run;
proc sort data=twob;
by ptid;
run;
proc sort data=twoc;
by ptid;
run;
data three;
merge twoa twob twoc;
by ptid;
run;
--------------------
Kristi Mahadocon <KMahadocon@PCYC.COM> wrote in message
news:D68062CCF0ACD511AF80009027C476E250D514@pcyc_nt1.pcyc.com...
I have a dataset with several observations per patient (like this sample):
Label OnsetDt PtID HistYN
Atrial Prematurities 00/00/2000 55005 Yes
Angina 01/17/2001 55005 Yes
Hypertension . 55005 No
and I want to transpose it into one observation per patient. Something like:
PtID AtrHist ArialDt AngHist AngDt HypHist HypDt
55005 Yes 00/00/2000 Yes 01/17/2001 No .
I've been experimenting with proc transpose, but haven't been able to
produce the exact results that I'm looking for. Any suggestions on the most
efficient way to program this would be greatly appreciated.
Thanks in advance.
Kristi Mahadocon
Clinical Database Programmer
Pharmacyclics, Inc.
www.pcyc.com
|