Hallo Statalists.
I have the following question for you. Take the following two variables, id_code identifies the individual observations of a sample of individuals, N identifies the number of observations for each individuals. Observations are sorted by id_code:
id N
1 2
1 2
2 2
2 2
3 4
3 4
3 4
3 4
Hence N is obtained as: bysort id_code: gen N=_N
Unfortunately I do not observe id_code (although the data are sorted by it). I'd like to generate id, starting from:
N
2
2
2
2
4
4
4
4
Hope my question is clear. Any idea? Many thanks in advance!
Marianna
Related Posts with How to identify ID_code from _N
Multiplicative versus additive IV PoissonI am using the IV Poisson to address the endogeneity issues in my gravity model. However, when I use…
cross-referencing tables produced with esttab in markstatReferencing equations and figures (as described here: https://data.princeton.edu/stata/markdown/cros…
Regarding time-fixed effect in panel regressionI have a basic econometrics concept query. I have a model where the dependent variable is both time …
How to test for heteroskedasticity in a panel data-setHello, I have a panel data set with 180 countries observed during the period 2008-2017, I am trying…
Obtaining standard error for covariance in mixed effect modelDear Statalist, I was wondering if anyone knows how I could obtain the standard error for the covar…
Subscribe to:
Post Comments (Atom)
0 Response to How to identify ID_code from _N
Post a Comment