Satyarth Kulshrestha
>
> I need to convert a integer variable to string so that i
> can add "51" at
> the end of all the values. how to do this?
A concurrent thread touches on pertinent issues.
Also, there is a longer discussion in Stata Journal
2(3), 314-329 (2002).
In that thread I urged the merits of keeping ids as
string, although much depends on the details.
In this case,
. gen str1 newid = ""
. replace newid = string(id, "%12.0g") + "51"
Naturally you could try it as a numeric operation: multiply by 100
and add 51, but to keep precision in all digits, make sure the
result is put in a -double- or -long-.
Nick
[email protected]
*
* 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/