Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: RE: working with date values

From   "Lachenbruch, Peter" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: working with date values
Date   Wed, 11 Jul 2012 07:59:42 -0700

read the friendly manual under dates  There's a lot there.  you can consider labeling your data

From: [email protected] [[email protected]] On Behalf Of Data Analytics Corp. [[email protected]]
Sent: Wednesday, July 11, 2012 6:52 AM
To: [email protected]
Subject: st: working with date values

Hi [email protected],

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"?




Walter R. Paczkowski, Ph.D.
Data Analytics Corp.
44 Hamilton Lane
Plainsboro, NJ 08536
(V) 609-936-8999
(F) 609-936-3733
[email protected]

*   For searches and help try:
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index