I need to generate 24 variables and I'm wondering if there is a way to create a loop that will make it faster and save 48 lines of code. They have the same naming structures, but I'm not sure that's enough to create a loop. I have 21 more variables, all with the same naming structure, to code.
Code:
gen acc_star = "*" if acccnt<7 replace acc_star = acc_rank if acccnt>=7 gen fin_star = "*" if fincnt<7 replace fin_star = fin_rank if fincnt>=7 gen rest_star = "*" if restcnt<7 replace rest_star = rest_rank if restcnt>=7
Comment