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

Re: st: Formatting of dates


From   "Eric G. Wruck" <[email protected]>
To   [email protected]
Subject   Re: st: Formatting of dates
Date   Fri, 9 Sep 2005 09:05:26 -0400

Svend & Mosca:

You may want to go one additional step...

After constructing year,


>    gen x = strpos(datetime," ")
>    gen year = substr(datetime, x-4, 4)
>

year is obviously a string variable.  If this does not suit your purposes, then

destring year, replace

should do it for you.


EGW



-- 

===================================================

       Eric G. Wruck
       Econalytics
       2535 Sherwood Road
       Columbus, OH  43209

       ph:      614.231.5034
       cell:    614.330.8846
       eFax:    614.573.6639
       eMail:   [email protected]
       website: http://www.econalytics.com

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