datelist.hlp
来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· HLP 代码 · 共 118 行
HLP
118 行
{smcl}
{* 28feb2005}{...}
{cmd:help datelist}
{hline}
{title:Title}
{hi:[U] 11.1.9 datelist}
{title:Description}
{pstd}
A {it:datelist} is a list of dates used with graph options, mainly, when the
variable being graphed has a date format.
{pstd}
Dates in Stata are recorded 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.
That is, that is how dates are recorded if we are talking in terms of daily
dates. Stata has weekly, monthly, quarterly, halfyearly, and yearly dates,
too. Each is recorded with 0 referring to the first week, month, quarter,
halfyear, or year following 31dec1959.
{pstd}
A datelist is either a list of dates, as in
{pmore}
15apr1973{break}
17apr1973 20apr1973 23apr1973
{pstd}
or it is a first and last date with an increment in between, as in
{pmore}
17apr1973(3)23apr1973
{pstd}
or it is a combination:
{pmore}
15apr1973 17apr1973(3)23apr1973
{pstd}
Dates specified with spaces, slashes, or commas must be bound in
parenthesis, as in
{pmore}
(15 apr 1973) (april 17, 1973)(3)(april 23, 1973)
{pstd}
Evenly spaced calendar dates are not especially useful, but with other
time units, even spacing can be useful, as in
{pmore}
1999q1(1)2005q1
{pstd}
which means every quarter between 1991q1 and 2005q1, or
{pmore}
1999q1(4)2005q1
{pstd}
which means every first quarter.
{pstd}
To interpret a datelist, Stata first looks at the format of the
variable and then uses the corresponding date-to-numeric translation function.
For instance, if the variable has a {cmd:%td} format (meaning it is daily),
then the {cmd:d()} function is used translate the date. If the variable has a
{cmd:%tq} format (meaning it is quarterly), then {cmd:q()} function is used.
The full list is
Format of{...}
{col 33}translation
variable{...}
{col 20}meaning{...}
{col 33} function{...}
{col 46}example
{hline 46}
{space 3}{cmd:%td}{...}
{col 20}daily{...}
{col 33}{space 4}{cmd:d()}{...}
{col 46}15apr1973
{space 3}{cmd:%tw}{...}
{col 20}weekly{...}
{col 33}{space 4}{cmd:w()}{...}
{col 46}1980w10
{space 3}{cmd:%tm}{...}
{col 20}monthly{...}
{col 33}{space 4}{cmd:m()}{...}
{col 46}2001m2
{space 3}{cmd:%tq}{...}
{col 20}quarterly{...}
{col 33}{space 4}{cmd:q()}{...}
{col 46}1999q1
{space 3}{cmd:%th}{...}
{col 20}half yearly{...}
{col 33}{space 4}{cmd:h()}{...}
{col 46}2001h1
{space 3}{cmd:%ty}{...}
{col 20}yearly{...}
{col 33}{space 4}{cmd:y()}{...}
{col 46}2001
{hline 46}
{title:Also see}
{psee}
Manual: {bf:[U] 11.1.9 datelist}
{psee}
Online: {help numlist}
{p_end}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?