> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Sent: Friday, April 11, 2008 4:44 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: how to deal with multiple ID
> I have a dataset like this.How could I get the difference between the
> third and fourth observations for each of the group? for example for
> the group 1 I need to get the difference for the observation of 45 and
> 34. For the second group I need the difference of 76-34 and so on...
> How to write a program to realize this? Thanks so much!
I am assuming that your sample data faithfully represents what your data actually looks like: in sorted order, each group having exactly 4 observations. Something like this will work
input group x;
data want ;
diff_34 = dif(x);
if last.group then output;
If this doesn't meet your needs, write back to the list with more detail.
Hope this is helpful,
Bothell, WA USA