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

Re: st: cut string


From   [email protected]
To   [email protected]
Subject   Re: st: cut string
Date   Sun, 12 Dec 2004 10:36:15 -0000 (GMT)

look for -egen-, substr()

I think the command you're looking for would be:

egen icd_9=substr(icd_10, 1, 3)




> Dear Statalists,
>
> I want to generate a newvar icd_9 with only the firt 3 letters from oldvar
> icd_10.
>
> icd_10        icd_9
> B51.0        B51
> B51.8        B51
> B52.0        B52
> B52.8        B52
> B52.9        B52
> .....            .....
> This can be done in EXCEL with LEFT command line e.g: left(B51.9, 3)=B51
> But I don't know how to do it in Stata(8) Command
>
> Any help will be appreciated
>
> Many thanks in advance.
>
> Dr. Ha Thai Son
> NIMPE Hanoi, Vietnam
>
> *
> *   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/
>


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