Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: two-digit string variables


From   Alejandro Delafuente <[email protected]>
To   [email protected]
Subject   Re: st: two-digit string variables
Date   Thu, 9 Jun 2005 14:11:12 +0100 (BST)

Many thanks for your help!
In message <[email protected]> [email protected] 
writes:
> . replace x = "0" + x if length(x) == 1
> 
> Alejandro Delafuente
> 
> I have a string variable with two-digit and one-digit values. How can I 
> tell Stata to place zeros before those one-digit values so that I end up 
> with two digits in all cases always. For instance,
> x          x(desired)
> 34           34
> 3            03
> 25           25
> 
> *
> *   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/
> 

-- 
Alejandro de la Fuente
QEH/Department of International Development
Oxford University
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index