Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: date format

From   "Terra Curtis" <>
To   <>
Subject   RE: st: date format
Date   Tue, 20 Sep 2005 12:24:48 -0400

Thanks, Nick.   

-----Original Message-----
[] On Behalf Of n j cox
Sent: Tuesday, September 20, 2005 11:42 AM
Subject: Re: st: date format

The format of the variable, here %dN/D/Y, is essentially a cosmetic matter.
What you should be worried about is whether some of the values are about a
century out, because of some previous error on reading the data into Stata.

Suppose the variable concerned is called -date-.

count if year(date) < 1910

will reveal how many are a century out. If there are some they need fixing

replace date = mdy(month(date), day(date), year(date) + 100) if
year(date) < 1910

and you need to revise analyses done with these data.


Terra Curtis wrote

I have a variable of type %dN/D/Y.  Some of the dates are in years
2000-2005.  When I sort by this variable, Stata seems to recognize some of
the 2000-2005 dates as 1900-1905, hence putting them as the earliest date
rather than the most recent.  Any ideas as to how to get Stata to recognize
01/01/05 as a 2005 date rather than 1905?

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index