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
Probit model constant termHey I have a sample with different start ups, the funding amount, and three different investor type…
Advice on which model to use with binary dependent variable and endogenous ordinal independent variableHello, I have come to a roadblock in my research. I am trying to figure out what type of model to us…
Data managementHello, I have Data like this input double id str6 V1 long V2 long V3 1 "A" 20180103 20180830 2 "B" …
Generating Variable Based On Several ConditionsDear board members, the simplified structure of my data is as follows: i have a panel data set on t…
Margins after -gsem-Dear all, I am having some trouble with my margins command after -gsem-. Here below my data looks l…
Subscribe to:
Post Comments (Atom)
0 Response to How to identify ID_code from _N
Post a Comment