Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: working with date values


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: working with date values
Date   Wed, 11 Jul 2012 15:35:36 +0100

Just to point out that this is definitely _not_ the answer. See my earlier post if needed.

Nick 
n.j.cox@durham.ac.uk 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of tashi lama
Sent: 11 July 2012 15:23
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: working with date values

You could change the display format of date 

 

format date %tdmonCCYY

 

see date display format 

 

Hope it helps, 

Tashi 

 


 


> Date: Wed, 11 Jul 2012 09:52:08 -0400
> From: walt@dataanalyticscorp.com
> To: statalist@hsphsun2.harvard.edu
> Subject: st: working with date values
> 
> Hi statalist@hsphsun2.harvard.edu,
> 
> I'm confused on handling dates. I imported a dataset on steel shipments 
> that has a variable called date. This is a string with the first date 
> value as "01/01/1984" for Jan 1, 1984. Using describe, I see that date 
> is str10 %10s. I then did
> 
> gen date2 = date(date, "MDY")
> 
> and the first value for date2 is 8766. Then I did
> 
> format %tm date2
> 
> and I expected to see jan1984 after doing a list. But I got 2690m7. 
> When I did
> 
> format %td date2
> 
> I got 01jan1984. I want jan1984. How do I do this? What is the 
> correct way to convert a string that's in the form "MM/DD/YYYY"?
> 

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