I have this kind of reproducible code:
Code:
clear set obs 10 gen str names = "" gen num = _n su num, meanonly di `r(max)' local abc a b c d e f g h i l forval i = 1/`r(max)' { foreach x of local abc { replace names=`"`x'"' if num == `i' } }
I also checked Statalist but could not figure out why the code is not working.
I'm sure it's a silly mistake, but I find myself stuck.
Thank you
0 Response to Loop going through distinct values of variable1 and replacing distinct string in variable2 per each iteration
Post a Comment