Date: Wed, 14 May 2008 12:05:05 -0700
Reply-To: jn mao <jn_mao@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: jn mao <jn_mao@YAHOO.COM>
Subject: How to generate a delta variable in longitudinal data
In-Reply-To: <6a180f91-61e7-40c4-b9bb-ffb14b07d7ec@24g2000hsh.googlegroups.com>
Content-Type: text/plain; charset=iso-8859-1
Hello SAS-Ls,
I have a longitudinal data file. There are 10 time points, I need to generate a new variable that is the difference of the value of the old variable between each time point and the baseline time point. How do I generate it?
The original data format:
Id Time Var1
1 0 10
1 10 12
1 20 11
1 30 17
The data I want:
Id Time Var1 Delta1
1 0 10 0 (10-10)
1 10 12 2 (12-10)
1 20 11 1 (11-10)
1 30 17 7 (17-10)
Could someone help me on SAS code for generating Delta1? Thanks much!
Jane
|