Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: converting elapsed days to date.


From   Jeph Herrin <junk@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: converting elapsed days to date.
Date   Thu, 28 Aug 2008 09:59:03 -0400

As Maarten points out, -format- will display an elapsed
date in conventional notation.

If on the other hand you truly want to "reverse this"
and separate out the components of an elapsed date, then
see the functions -year()-,-month()-, and -day()-.

. gen year=year(stdate)

Jeph

Maarten buis wrote:
--- Ashim Kapoor <ashimkapoor@gmail.com> wrote:
I understand that if I have the month , day ,year I can do

gen stdate= mdy(month,day,year)

is there a way I can "reverse this" ie. given the elapsed days can I
figure out todays date in the format 20080828 for say today?
Yes, you use -format-, see: -help format-

-- Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

Send instant messages to your online friends http://uk.messenger.yahoo.com *
* 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/

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