Hi Folks-

The issue I'm having is that when I have a variable list after egen, and the variable list is comprised of macros from loops, Stata/SE 16.1 for Windows (64-bit x86-64) is interpreting the variable list as one long variable name (i.e. interpreting it as through there weren't spaces between the variables in the variable list).

So, for instance, if I wrote:

Code:
        forvalues i=1/3 { 
            foreach pre in a_ b_ c_ {
               egen r`i'`pre'max = rowmax(r`i'`pre's r`i'`pre'q r`i'`pre'w)
            }    
        }
it would return the error: "r1a_s r1a_q r1a_w not found"

But I use find and replace to change those local macro identifiers into the first instance of each of the loops (show below) it works just fine.
Code:
 egen r1a_max = rowmax(r1a_s r1a_q r1a_w)
My guess is there is an obvious answer here. But I don't know it.

Any help is appreciated.

Kind regards,
Ben