Date: Wed, 24 Sep 2003 11:46:55 -0400
Reply-To: Robert Abelson <rabelson@KAI-RESEARCH.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robert Abelson <rabelson@KAI-RESEARCH.COM>
Subject: Re: proc transpose?
Content-Type: text/plain
This is easily done in a data step:
data new(keep=id date dx);
set old;
array _dx[*] dx1-dx3;
do i=1 to hbound(_dx);
dx = _dx[i];
if dx ne " " then output;
end;
run;
Bob Abelson
KAI Research, Inc.
6001 Montrose Rd.
Suite 920
Rockville, MD 20852
T: 301-770-2730
F: 301-770-4183
rabelson@kai-research.com
> jcern
> <jcern15@YAHOO.C To:
> SAS-L@LISTSERV.UGA.EDU
> OM> cc:
> Sent by: "SAS(r) Subject: proc transpose?
> Discussion"
> <SAS-L@LISTSERV.
> UGA.EDU>
>
>
> 09/24/2003 09:46
> AM
> Please respond
> to jcern
>
>
>
>
>
>
> I am trying to transpose some variables into observations and for some
> reason proc transpose isn't really working. My data looks something
> like this:
>
> ID Date DX1 Dx2 Dx3
> 001 1/1/00 789.0 453.1 678.4
> 001 1/1/00 675.0 V57.0
> 001 3/24/01 453.2 234.9
>
> I want the output to look like this:
>
> ID DATE DX
> 001 1/1/00 789.0
> 001 1/1/00 453.1
> 001 1/1/00 678.4
> 001 1/1/00 675.0
> 001 1/1/00 V57.0
> 001 3/24/01 453.2
> 001 3/24/01 234.9
>
> For some reason the proc transpose is transposing BOTH ways in the
> same step: it is creating VARIABLES as well as new observations. Not
> sure why...
>
> Thanks!
|