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
Using nlcom and lincom after marginsI have been attempting to compare the two items in a margins output table (calculated at a specific …
Legend option in Graph barDear All, I want to make a graph bar over a categorical variable (4 categories). My data looks as f…
How to use if statement in foreach loop?I'm attempting to plot gas concentrations over time, but want to format the graphs differently for s…
Simple wrapper for set traceI am attempting to write wrapper programs that allow me to type ston and stoff instead of set trace …
Family Fixed Effects with large number of fixed effectsHi Everyone, I am trying to run family fixed effects. I have a ton of mother ids to identifiy where…
Subscribe to:
Post Comments (Atom)
0 Response to Need Help on STATA loop
Post a Comment