Hello,
I've data were I have for one reporting date several observations, but I only want keep the first one. I've just two alternative ways of doing this, but strangely I get different results.

Method 1
egen id=group(x1 x2 x3)
by id (x4),sort: keep if _n==1

Method 2
by x1 x2 x3 (x4), sort: keep if _n==1

I've used the first method because I wanted a unique id for each reporting date. Surprisingly, the two methods give different results. My dataset is pretty large, i.e. 80 million observations. I then tried it with a smaller subset and get the same results, i.e. the two methods are yielding the exact same result.

Am I missing something?

Thanks.