Hello,

I wish to loop n times, say:

forvalues i = 1(1)n{

and n is defined by the last number of id:

egen id = group(firm)

May I kindly ask how to write this code please?