Hi, I have a long-long format data set as below, I made reshaping before, but this time it is hard to find "j()" in the general reshape code. As you see 5678000 id numbered respondent has 4 observation and variable "activity_rtr " repeats 3 times and "spell_rtr" variable repeats itself as well. I have no other choice to create a variable having a unique value within the same id. Lets say this new variable is "newid ". I want to have this kind of look at below. How can I code this?
id newid
5678000 1
5678000 2
5678000 3
5678000 4
5780000 1
5843000 1
Array
Related Posts with reshaping and creating unique "j()" within same id
Using EGEN to Create Count VariableHello Statalisters, I am trying to create a variable that counts the number of times a particular c…
SEM panel model with three variables: cross-lagged vs synchronousI have limited training in SEM and have a couple of questions about a somewhat complicated model dec…
Interpretation of two-way interaction plotHello Statalist I have a question regarding the attached two-way interactions plot: [ATTACH=CONFI…
Regressions Table in StataHow to create a table in Stata which shows the difference of two regression results previously run? …
Clustering SEsHi all, I have a question regarding some clustering of standard errors. I read a great paper by M. …
Subscribe to:
Post Comments (Atom)
0 Response to reshaping and creating unique "j()" within same id
Post a Comment