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
Football and Covid, problem in including some teamsGood Evening. I am dealing with a project in Econometrics, in which I have to see what is the effec…
FRM estimation in panel dataDear researchers, I estimate balanced panel data N = 77, T = 6, in which the dependent variable is …
Catplot - bar widthDear all, I am trying to plot stacked bar charts using -catplot-. I would like to reduce the width …
Panel yes / no and how do deal with themDear Community, I am collecting data from the updates that various projects have. I would like to in…
Reliability in factor analysisHello everybody I just have a general statistical question: Raykovs reliability coefficients is by …
Subscribe to:
Post Comments (Atom)
0 Response to How to identify ID_code from _N
Post a Comment