Stata 15 help for datelist

Title

[U] 11.1.9 datelist

Description

A datelist is a list of dates or times and is often used with graph options when the variable being graphed has a date format. For a description of how dates and times are stored and manipulated in Stata, see [U] 24 Working with dates and times. Calendar dates, also known as %td dates, are recorded in Stata as the number of days since 01jan1960, so 0 means 01jan1960, 1 means 02jan1960, and 16,541 means 15apr2005. Similarly, -1 means 31dec1959, -2 means 30dec1959, and -16,541 means 18sep1914. In such as case, a datelist is either a list of dates, as in

15apr1973 17apr1973 20apr1973 23apr1973

or it is a first and last date with an increment between, as in

17apr1973(3)23apr1973

or it is a combination:

15apr1973 17apr1973(3)23apr1973

Dates specified with spaces, slashes, or commas must be bound in parentheses, as in

(15 apr 1973) (april 17, 1973)(3)(april 23, 1973)

Evenly spaced calendar dates are not especially useful, but with other time units, even spacing can be useful, such as

1999q1(1)2005q1

when %tq dates are being used. 1999q1(1)2005q1 means every quarter between 1999q1 and 2005q1. 1999q1(4)2005q1 would mean every first quarter.

To interpret a datelist, Stata first looks at the format of the related variable and then uses the corresponding date-to-numeric translation function. For instance, if the variable has a %td format, the td() function is used to translate the date; if the variable has a %tq format, the tq() function is used; and so on. See Conveniently typing SIF values in [D] datetime.


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