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

Re: st: cut variables


From   Seb Buechte <[email protected]>
To   [email protected]
Subject   Re: st: cut variables
Date   Thu, 10 Nov 2005 16:54:28 +0100

Patricia,

in case the two digits are alwas positioned in the very beginning of
the string, you could try this:

gen first_two_digits=substr(name_of_str_variable,1,2)

And you may want to take a look at..:
-help substr-


Kind regards,
sebastian



On 11/10/05, Patricia Vera Rojas <[email protected]> wrote:
> Hi,
>
> I have a string variable with different size:
>
> 01 XXX YYY ZZZ
> 02 XXXX YYY ZZZZZZ
> .
> .
> .
> .
> .
> 30 X Z YYYYY
>
> I want to get only the first two digits (01 to 30)
> How can I do it?
>
> Thanks,
> Patricia
>
>
>
> ______________________________________________
> Renovamos el Correo Yahoo!
> Nuevos servicios, m�s seguridad
> http://correo.yahoo.es
> *
> *   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/
>


--
- Seb F Buechte
-
- Stay tuned!

*
*   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