Date: Sat, 31 Mar 2001 05:38:58 GMT
Reply-To: David Yamanishi <yamanishi@NOSPAM.MEDIAONE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Yamanishi <yamanishi@NOSPAM.MEDIAONE.NET>
Organization: Road Runner
Subject: Transpose question
Content-Type: text/plain; charset=us-ascii
Thanks to those who helped me a few days ago, but apparently I didn't
ask my second question clearly enough to get a response that did what
I hoped for. So:
I have data like:
unit person var1 var2 var3
1 1 13 14 15
1 2 31 32 33
1 3 92 47 23
2 1 14 18 19
2 2 41 98 23
2 3 77 78 79
2 4 81 89 83
3 1 19 19 10
3 2 24 23 22
There are multiple persons per unit, but the number varies (the max is
14), and multiple variables per person (a fixed number).
What I want is:
unit p1v1 p1v2 p1v3 p2v1 p2v2 p2v3 p3v1 p3v2
p3v3 p4v1 p4v2 p4v3
1 13 14 15 31 32 33 92 47
23 . . .
2 14 18 19 41 98 23 77 78
79 81 89 83
3 19 19 10 24 23 22 . .
. . . .
So I'd like to have one observation per unit, with all the people
moved into that one observation (I'm going to need to compare values
of v1, v2, and v3 across persons within a unit), and the variables
named to indicate person and variable.
It would be nice if the number of people could be set by actually
finding the largest number of people in any unit, rather than having
to know it in advance.
Also -- there are more than 9 million people in the data, divided into
about 700,000 units, so if there's a more efficient way of doing
something, it would help (my efforts so far tend to take about 25
minutes to produce bad results on my system).
Thanks --
David