Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65052

drop the largest observation by id

$
0
0
Hello, my data looks like this

id distance
1 300
1 20
2 500
2 450
3 6
3 780
4 9000
4 30

Each id appears twice because there are two distance values for each id. I would like to drop the larger distance value. For example, for id = 1, I want to keep 20 and drop 300.

I have tried combining the drop, by and sort commands, but so far nothing has worked for me.

Viewing all articles
Browse latest Browse all 65052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>