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.
Related Posts with working of egen group
fixed effects specification: dummies (LSDV) vs within estimatorHello everyone, I have a question on the various specifications of a fixed effect model. I always …
Label variables ascending orderHi, I am using Stata 17. I have 61 variables in my dataset (q1-q61). I would like to label them as…
Stata odbc query column labels from impalaI am trying to access data from impala sql into Stata: Code: clear all #delimit; odbc load, exec…
Substantially different estimates for variance of random effects for different estimation techniquesDear Statalisters, I currently analyze an unbalanced panel with about 200 different firms and aprxi…
Chow test in panel dataHi all, My estimated equation takes form of: ln(I)=B1ln(w1)+B2ln(w2)+B3ln(w3)+(control variables)+e…
Subscribe to:
Post Comments (Atom)
0 Response to working of egen group
Post a Comment