Hello Everyone!
I have a question about generating a sequence in Stata with a condition. I have a variable ( var= 0,0,0,1,0,0,1,0,0,0) and want to generate a sequence with a break whenever var=1 and then restarts. The new variable will be like this (newvar = 1,2,3, . , 1, 2, ., 1, 2, 3). I would appreciate your help in this respect.
Moeen
Related Posts with Sequencing with a condition
Deleting rows with the same valuesDear Statalists, In my dataset i have rows with same value, more precisely "NA" therefore i want to …
Splitting string in two numeric variablesHello! My data set includes a variable called price that is recorded as an interval (in most cases):…
Issue with Reshape Code: * Example generated by -dataex-. To install: ssc install dataex clear input str25 VarYr str2…
Get no. of times for loop has iteratedIs there a way that I can access the number of times a given loop is on. For example, Code: sysus…
Working with bootstrap, program and foreachHello, I have investigated my problem and have not been able to find a solution. I would like to ca…
Subscribe to:
Post Comments (Atom)
0 Response to Sequencing with a condition
Post a Comment