Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to make ID as 01 instead of 1


From   Hưng Đoàn Quang <[email protected]>
To   [email protected]
Subject   Re: st: How to make ID as 01 instead of 1
Date   Thu, 25 Feb 2010 23:15:05 +0700

You can try to use the following command
tostring ID, replace
gen strID = "0" + ID

It is hopeful that can help you.

Hung,

Full name: Doan Quang Hung
Lecturer: Stata, SPSS, Fundamental Statistics and CsPro
Mobile: 84 (0) 982 609 551


On Mon, Dec 14, 2009 at 7:44 PM, Quang Nguyen <[email protected]> wrote:

> Dear all:
>
> Can you show me how I can generate ID in the following manner: 01,
> 02..... instead of 1, 2, 3...?
>
> From the original data, I have ID in the form of 1, 2, ...... I then
> use the following commands:
>
> tostring ID, replace
> replace x = "01" if x=="1"
>
> There was a message "type mismatch".
>
> Any help is appreciated.
>
> Sincerely yours,
>
> Quang
>
>
> --
> "My father gave me the greatest gift anyone could give another person,
> he believed in me." - Jim Valvano
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index