Statalist The Stata Listserver


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

Re: st: RE: Time/Date Functions


From   "Danielle H. Ferry" <dferry@nber.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Time/Date Functions
Date   Wed, 15 Mar 2006 17:09:39 -0500

Aha! You are right (of course). I _am_ an idiot. I'm too embarrassed to
explain where I went wrong. Thanks, Nick, for inadvertently making me see the
light.

Danielle

--
National Bureau of Economic Research <http://www.nber.org>


---------- Original Message -----------
From: "Nick Cox" <n.j.cox@durham.ac.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wed, 15 Mar 2006 21:53:38 -0000
Subject: st: RE: Time/Date Functions

> You're not telling us everything, I surmise, 
> as there's nothing wrong with your syntax.
> 
> . clear
> 
> . set obs 1 
> obs was 0, now 1
> 
> . gen month = 1
> 
> . gen day = 1
> 
> . gen year = 2000
> 
> . tempvar time
> 
> . ge `time' = mdy(month, day, year)
> 
> . ge junk = month(`time')
> 
> . l
> 
>      +--------------------------------------+
>      | month   day   year   __000000   junk |
>      |--------------------------------------|
>   1. |     1     1   2000      14610      1 |
>      +--------------------------------------+
> 
> Nick 
> n.j.cox@durham.ac.uk

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