Speaking Stata: Nine notes on dealing with dates and times
Nicholas J. Cox ()
Additional contact information
Nicholas J. Cox: Durham University
Stata Journal, 2025, vol. 25, issue 2, 471-483
Abstract:
This is an informal overview of several key points in dealing with date and time data in Stata. Dates and times in Stata are integers with specified units. Years are usually easy to handle. Otherwise, dates in Stata have origin at the beginning of 1960. Date or time inputs often need translation to Stata dates or times. Conversion from one kind of date or time to another requires a special function, as does extraction of date or time components. Weeks are different. Assigning date or date-time display formats is essential to understand your variables. Once your dates and times are set up, consider tsset or xtset. I also explain how month names or abbreviations may be mapped to integers 1 to 12 and how fraction of year may be calculated, which is useful for fitting sinusoids.
Keywords: dates; times; clock; daily; weekly; monthly; quarterly; half- yearly; yearly; format; tsset; xtset (search for similar items in EconPapers)
Date: 2025
Note: to access software from within Stata, net describe http://www.stata-journal.com/software/sj25-2/dm0116/
References: Add references at CitEc
Citations:
Downloads: (external link)
http://www.stata-journal.com/article.html?article=dm0116 link to article purchase
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:tsj:stataj:v:25:y:2025:i:2:p:471-483
Ordering information: This journal article can be ordered from
http://www.stata-journal.com/subscription.html
DOI: 10.1177/1536867X251341416
Access Statistics for this article
Stata Journal is currently edited by Nicholas J. Cox and Stephen P. Jenkins
More articles in Stata Journal from StataCorp LLC
Bibliographic data for series maintained by Christopher F. Baum () and Lisa Gilmore ().