Statalist


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

st: RE: Extract Year from String


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Extract Year from String
Date   Tue, 13 Oct 2009 19:08:51 +0100

Use the -substr()- function. More generally, check out string functions.


Nick 
[email protected] 

[email protected]

I need to extract year from a string variable (str24  %24s).
How can I extract, for example, 1998 from this observation:
Dec/17/1998 11:30:00 PM

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