At 09:30 AM 9/6/2007, Franco wrote:
Hi,
I have a numeric variable, "ind" which goes from 1 to
20.
I want to convert it into a string variable "indstr",
that goes from 01 (as opposed to 0) to 20.
How can I achieve this?
Try,
tostring ind, gen(newvar) format(%02.0f)
Note the use of the format option, and the leading-zero format.
See -help tostring- and -help format-.
--David
*
* 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/