Statalist


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

Re: st: Extract Year from String


From   Bryce Mason <bmason5@lmu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Extract Year from String
Date   Tue, 13 Oct 2009 11:09:59 -0700

See "help substr"

gen stuff=substr(var,8,4)


On Oct 13, 2009, at 11:05 AM, jasonm@ucla.edu wrote:

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
Thank you.

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

Bryce Mason, Ph.D.
Director of Institutional Research
Loyola Marymount University
1 LMU Drive | Los Angeles, CA 90045

b:	4823 University Hall
w:	(310) 258-8838
f:	(310) 338-1841
e:	bmason5@lmu.edu




*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index