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
Displaying a Complex TableGood morning everyone! I'm quite new to STATA and try to display a complex table, but even after ho…
testing for serial correlation in residuals of fixed effects model (xtqptest on reghdfe)I want to test for first order serial correlation in the residuals of this Stata regression model: …
Collecting exact 95% CII am conducting a survey analysis where I'm looking at proportions with the svy command. I'm using t…
Multiple imputation for handling missing data in multiple covariatesDear All, While adapting multiple imputation in longitudinal datasets to handle missing data in mul…
matching with smae (Chinese) words?Dear All, I found this question here (https://bbs.pinggu.org/thread-10628284-1-1.html). Suppose that…
Subscribe to:
Post Comments (Atom)
0 Response to reshaping and creating unique "j()" within same id
Post a Comment