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
Keep variable1 if 1 observation per year OR*the minimum number for a variable2 if > 1 observations per yearNeed help! My goal is to write code to keep a single HbA1c value per year closest to each participan…
Combine histogram and connected line graph over timeDear Statalist forum users, I came across this graph in a published paper and want to produce a simi…
Mixed effects Panel Data modelwhen to know when to use mixed effects panel data model in stata? …
How to create new columns for each country observation and count this number of countries?Dear all, I wanted your help with the following. I am working on a patent project and in the follow…
putexcelDear All, I nested putexcel into a loop. I need to estimate the same model for 500 assets and i wou…
Subscribe to:
Post Comments (Atom)
0 Response to reshaping and creating unique "j()" within same id
Post a Comment