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
High R-sqaured, Low Variable SignificanceHi everyone! I am currently working on a project that used secondary data and struggle a bit with th…
Diff GMM Stationarity ConcernsHi all, I am conducting an analysis with T=32 (quarters) and N=52 using difference GMM. I have my r…
Long-term effective tax rate over 5 yearsDear Stata experts I am a bloody beginner when it comes to stata. I am working with unbalanced pan…
MergingI am using time use survey 2019 in India.I have extracted 5 datasets of different levels.In level5 e…
List of unique values for a variableHello Statalist users, I am working on a dataset which contains the countries of export (in some ca…
Subscribe to:
Post Comments (Atom)
0 Response to reshaping and creating unique "j()" within same id
Post a Comment