ywfcns.hlp

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· HLP 代码 · 共 88 行

HLP
88
字号
{smcl}
{* 07apr2005}{...}
{cmd:help ywfcns}
{hline}

{title:Title}

{p2colset 5 41 46 2}{...}
{p2col :{hi:[U] 24.3.1 Inputting time variables}}{hline 2}
Functions for creating dates from year and week, year and quarter, ...{p_end}


{title:Syntax}

{pstd}
The {cmd:yw()}, {cmd:ym()}, {cmd:yq()}, and {cmd:yh()} functions are defined

{p 8 25 2}{it:...} {cmd:yw(}{it:year_exp}{cmd:,} {it:week_exp}{cmd:)} {it:...}{p_end}
{p 8 25 2}{it:...} {cmd:ym(}{it:year_exp}{cmd:,} {it:month_exp}{cmd:)} {it:...}{p_end}
{p 8 25 2}{it:...} {cmd:yq(}{it:year_exp}{cmd:,} {it:quarter_exp}{cmd:)} {it:...}{p_end}
{p 8 25 2}{it:...} {cmd:yh(}{it:year_exp}{cmd:,} {it:halfyear_exp}{cmd:)} {it:...}


{title:Description}

    Function description:

{p 4 26 2}1st argument:{space 2}year; e.g., 1960, 1985, 2002, etc.{p_end}
{p 4 26 2}2nd argument:{space 2}{cmd:yw()}:{space 2}week number; 1, 2, ..., 52{p_end}
{p 19 26 2}{cmd:ym()}:{space 2}month number; 1, 2, ..., 12{p_end}
{p 19 26 2}{cmd:yq()}:{space 2}quarter number; 1, 2, 3, 4{p_end}
{p 19 26 2}{cmd:yh()}:{space 2}halfyear number; 1 or 2{p_end}

{p 4 26 2}Returns:{space 7}{cmd:yw()}:{space 2}{cmd:%tw} date{p_end}
{p 19 26 2}{cmd:ym()}:{space 2}{cmd:%tm} date{p_end}
{p 19 26 2}{cmd:yq()}:{space 2}{cmd:%tq} date{p_end}
{p 19 26 2}{cmd:yh()}:{space 2}{cmd:%th} date{p_end}


{pstd}
Also, for converting daily dates (see {help mdyfcn} for details) is

{p 8 27 2}{it:...} {cmd:mdy(}{it:month_exp}{cmd:,} {it:day_exp}{cmd:,} {it:year_exp}{cmd:)} {it:...}

{p 4 26 2}1st argument:{space 2}month number; 1, 2, ..., 12{p_end}
{p 4 26 2}2nd argument:{space 2}day-within-month number; 1, 2, ..., 31{p_end}
{p 4 26 2}3rd argument:{space 2}year; e.g., 1960, 1985, 2002, etc.{p_end}

{p 4 26 2}Returns:{space 7}{cmd:%td} date or missing value.


{pstd}
See {help tdates} for an explanation of {cmd:%t} dates.  See help
{help tfmt} for an explanation of time-series formats.


{title:Examples}

{phang}{cmd:. generate qdate = yq(hyr, hqtr)}{p_end}
{phang}{cmd:. format qdate %tq}

{phang}{cmd:. generate xdate = yq(1900+xyr, xqtr)}{p_end}
{phang}{cmd:. format qdate %tq}

{phang}{cmd:. generate hdate = mdy(hmo, hday, hyr)}{p_end}
{phang}{cmd:. format hdate %td}

{phang}{cmd:. generate bdate = mdy(1, 1, 1900+birthyr)}{p_end}
{phang}{cmd:. format bdate %td}


{title:Also see}

{psee}
Manual:  {bf:[D] functions},{break}
{bf:[U] 24 Dealing with dates},{break}
{bf:[U] 24.3.1 Inputting time variables}

{psee}
Online:  {help tdates},
{help tfmt};
{help dates},
{helpb format},
{help functions},
{help mdyfcn},
{help tfcn}
{p_end}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?