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
Taking Results from Tab2 and Using them to Generate/Recode a new variableI have a big dataset (1.7million obs) and I need to create contour plots by a member_id within the d…
event-study (event-study2)Hi all, I am using Stata 16. My study: I have two periods that I will evaluate; 2008 - 2013 and th…
Quick questions about the interaction methodsDear Researchers, Greetings, I have quick questions about interaction variables, please. At first,…
Linear interpolationHi! I have a variable called year in my dataset but this contains just the year 2006, 2009, 2011, 2…
Creating first-order difference variables in repeated cross-sectional (i.e. pseudo panel) dataGreetings, I'm running Stata 15.1 on OSX. I've created a repeated cross-sectional dataset to assess…
Subscribe to:
Post Comments (Atom)
0 Response to Sequencing with a condition
Post a Comment