Is there a way that I can access the number of times a given loop is on. For example,
Where the desired output would be
How can I define iteration_no to return the desired output. Thank you very much for your help.
Code:
sysuse auto foreach var in weight price mpg rep78 { /*1. Tabulate the variable*/ tab `var' /*2. The no. of times this loop has iterated*/ local iteration_no = di `iteration_no' }
Code:
A tabulation of weight 1 A tabulation of price 2 A tabulation of mpg 3 A tabulation of rep78 4
Comment