|
I have dataset1 below comprising id and height(ht). I want to compute the
difference in height for each id given by last minus first height.
For id 29, I have difference in height to be: last ht – lst ht ie. 355-
188 = 167(dataset2)
For id 31, I have difference in height to be: last ht – lst ht ie. 203-
112 = 91(dataset2)
At the end I expect to have dataset 2 with the difht computed.
What SAS code will help me find the difference between first and last
height for each id, please? I have 70 different ids to find the difference
between the first and last height.
Dataset1:
id ht
29 188
29 310
29 355
31 112
31 156
31 186
31 203
Dataset 2:
id ht difht
29 188
29 310
29 355 167
31 112
31 156
31 186
31 203 91
|