I'm trying to compute a value across observations. My data look like
ID LAND DECILE DISTANCE
1 85 1 1.5
1 85 2 3.4
.
.
1 85 9 13.2
2 76 1 0.9
2 76 2 2.7
I'm trying to calculate for each ID with ten deciles, (decile10 - decile(i+1))/(decile10 - decile1), where i is the ith decile. I'm not worried about decile 10. Thanks for any help! Been struggling with this all day.