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
Clustered sandwich estimator gives very differ error in gllamm, xtlogit and xtlogit bootstrapHi there I work in the rodent learning field and have been trying to model the effect of different …
error using command join from package ftoolsHello Statalisters I am using the command -join- from the package -ftools-, from SSC, in Stata 14.0…
Dividing a macro into segments of equal number of elements.I'm sure this is somewhat simple but haven't been able to wrap my head around it, so here it goes: …
panel data regressionValues of all the variable in my panel data regression are coming out to significant except one. I c…
Seeking advice on how to analyse different households' applicance use in response to a change in weatherHi all, To provide some context, here's a small sample of my data: input float(haze age ac_behav…
Subscribe to:
Post Comments (Atom)
0 Response to working of egen group
Post a Comment