Hello-

I'm trying to write a simple program to display a status bar during a forvalues loop. Right now, I'm manually entering the minimum and maximum of the range stated in the forvalues command, but it's not a very useful command if you have to re-type the min/max values every time. I'd like to automatically create local variables for the #1 and #2 arguments in the forvalues command. The following code creates what I'm looking for in a .do file:

Code:
forvalues i = 1/50 {

     * Display status of loop replications
        local pct = abs((`i'/50)*100)
        if `i' == 1 dis "Loop running: 0%" _continue
        if mod(`pct',10) == 0 & `i' != 50 dis "...`pct'%" _continue
        if `i' == 50 dis "...100%. DONE." _newline(1)
        
    sleep 250
}
The sleep command is just for testing purposes. I'd like to replace the 1 and the 50 with local variables captured from the forvalues command. If I could do that, it would give me a nice one-word program to create a status bar!

Thanks!
-Marc