Wednesday, March 15, 2006

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

Danielle H. Ferry > I apologize in advance b/c I think the answer must be obvious > - but I can't > seem to make this work and it is driving me nuts. > > I am trying to do the following: > > tempvar time; > ge `time' = mdy(month, day, year); > ge junk = month(`time'); > > The var `time' works fine. But I get only missing values for > junk. What am I > being thickheaded about? >

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


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?