Date: Thu, 29 Jan 2009 15:21:21 -0500
Reply-To: Jane <program.sas@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jane <program.sas@GMAIL.COM>
Subject: Question about the data step
Hi All
I have a question about the data step. The dataset look like below:
PID Index Speed Volume Status
----------------------------------------
A001 1 100 10 First
A001 2 120 10 Change
A001 3 120 Nochange
A001 4 100 9 Change
A001 5 90 9 Change
A001 6 90 Nochange
A001 7 80 70 Last
A002 1 130 9 First
A002 2 130 Nochange
A002 3 130 Nochange
A002 4 120 12 Change
A002 5 100 10 Change
A002 6 80 10 Change
A002 7 80 9 Last
A003 1 70 10 First
A003 2 80 12 Change
A003 3 80 Nochange
A003 4 80 Nochange
A003 5 80 Nochange
A003 6 80 Nochange
A004 7 80 15 Last
The 'PID' is the subject ID, each subject has several lines data. The index
is the data index. If the speed change, the volume will be record. For
example: A001,index 1 to index 2, the speed change from 100 to 120, the
volume recorded as 10. from index 2 to index 3, the speed does not change,
the volume recorded as empty. And, the first and last rows we should record
the volume.
My question is, the dataset is not quite cleaned, the column 'volume' is not
accurate, some subject missed this value. I want to get the column 'Status'
as showing above based on the 'Speed' status.
Does anyone have easy way to help me generate the column 'Status'? Thanks a lot!
Jane
|