Statalist


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

Re: st: Inserting a number into existing study ids


From   Paul McCabe <[email protected]>
To   [email protected]
Subject   Re: st: Inserting a number into existing study ids
Date   Wed, 4 Feb 2009 14:07:31 +0000

Assuming this is a string variable ID

gen ID2=substr(ID,1,1)+"0"+substr(ID,2,length(ID)-1)

Best wishes
Paul

2009/2/4 Polis, Chelsea B. <[email protected]>:
> Dear Statalisters,
>
> I need to insert a zero between the first and second characters in a column of study IDs.  For example, K04945 must become K004945. Any clues on how to achieve this?
>
> Many thanks!
> Chelsea
>
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index