Date: Wed, 28 Mar 2001 19:28:52 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: Two SQL(?) Questions
Content-Type: text/plain; charset=us-ascii
Hello,
A question for all of you enthusiastic SAS experts:
I have data that looks (abstractly) like this:
unit person var
1 1 6
1 2 18
2 1 19
2 2 20
2 2 14
2 2 11
3 1 12
3 2 9
3 2 4
So, in this example, there are three units represented in the a
column. Each unit has exactly one 1 person in the b column, but a
variable number of 2's (like a head of household and others). First,
the simple problem:
Count the number of 2's per unit and add it as a variable to the 1's
record (dropping all the 2 observations).
Next, the complex problem:
The c column represents an additional variable for each person. Is
there any way to create a dataset with flexible record length where
all the persons in each unit are merged into one record (and the var's
obviously renamed flexibly var1 var2 var3, one for each person)? Or,
alternatively, of fixed record length where the length is set
automatically according to the number of 2's in the unit with the most
people and the variables filled in for each 2 that's actually present
for each unit.
Thank you,
David
|