.
If that was the problem, then -renvars, postdrop(1)- is an alternative. 
Sergiy Radyakin
I don't think I understand how you want to transform X42 to X5 based
on your description, but if you'd like to keep two first characters of
the variable names
// begin of file
sysuse auto
ds
local vars `r(varlist)'
foreach var of local vars {
  rename `var' `=substr("`var'",1,2)'
}
// end of file
*
*   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/