Not the question, but note also that the problem being solved here is that 
also solved by the official Stata command -renpfix-. 
Nick 
[email protected] 
> foreach var of varlist haem_id - haem_nbc {
>          local newname=substr("`var'", 6, .)
>          rename `var' `newname'
>          }
> 
> or
> 
> foreach var of varlist haem_id - haem_nbc {
>          rename `var' `=substr("`var'", 6, .)'
>          }
> 
> for that matter.
> 
> On 10/30/06, Raphael Fraser <[email protected]> wrote:
> > Didn't work. From the trace as you said -substr(`var', 6, .)- is not
> > being evaluated as I expected. Typing the following in the command
> > line works:
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/