Hi
using the below loop, I could nicely generate a maximum value of my variables of interest. I was wondering if there is any way to wrap up the rest of my codes in a loop.
Thanks,
Nader

foreach v of varlist TLE_* HLE_* PLE_* {

egen max_`v' = max(`v')

}

*50_51
sum TLE_50_512 if TLE_50_512 > max_TLE_50_511
sum TLE_50_513 if TLE_50_513 > max_TLE_50_511
sum HLE_50_512 if HLE_50_512 > max_HLE_50_511
sum HLE_50_513 if HLE_50_513 > max_HLE_50_511
sum PLE_50_512 if PLE_50_512 > max_PLE_50_511
sum PLE_50_513 if PLE_50_513 > max_PLE_50_511
*60-61
sum TLE_60_612 if TLE_60_612 > max_TLE_60_611
sum TLE_60_613 if TLE_60_613 > max_TLE_60_611
sum HLE_60_612 if HLE_60_612 > max_HLE_60_611
sum HLE_60_613 if HLE_60_613 > max_HLE_60_611
sum PLE_60_612 if PLE_60_612 > max_PLE_60_611
sum PLE_60_613 if PLE_60_613 > max_PLE_60_611
*70-71
sum TLE_70_712 if TLE_70_712 > max_TLE_70_711
sum TLE_70_713 if TLE_70_713 > max_TLE_70_711
sum HLE_70_712 if HLE_70_712 > max_HLE_70_711
sum HLE_70_713 if HLE_70_713 > max_HLE_70_711
sum PLE_70_712 if PLE_70_712 > max_PLE_70_711
sum PLE_70_713 if PLE_70_713 > max_PLE_70_711