Hello, Everyone,
I want to assign individuals (id) into groups of five (group) in the following pattern -- how should I write stata code using "foreach" or maybe "forvalue"?
replace group=1 if id>=1 & id <=5
replace group=2 if id>=6 & id <=10
replace group=3 if id>=11 & id <=15
replace group=4 if id>=16 & id <=20
replace group=5 if id>=21& id <=25
.......
Thanks a lot!
Related Posts with Need Help on STATA loop
How are the p values of the synthetic control method obtained using only the "synth" command in STATA?Hi all, I want to ask if anyone knows the following and can help me: First, the topic is about the…
infile command cuts off the id variableHello! I would like to import a .txt file (which I created in Mplus, .raw would also be possible) b…
question about memory increase when performing an ordered probit modelHi, I am trying to run an ordered probit model on my data, the data has 12 var and 713397 obs. when…
Panel data analysis; reciprocity and OVB problemsHi everyone, I want to investigate the relationship between employment and crime on an individual a…
Dummy variable for group matched observationsDear all, I have a variable of unique ids for a dataset of survey respondents which I have matched …
Subscribe to:
Post Comments (Atom)
0 Response to Need Help on STATA loop
Post a Comment