Function Reference: Y
@year Year of the observation.
@ytd Within-year cumulative sum (year-to-date).
Year of observation.
Syntax: @year
Return: series
Returns the year associated with each observation in the workfile.
• If the workfile is undated, observations will be set to -1.
Examples
series dt = @year
saves the year into the series DT.
The command
workfile d7 2010 2022
smpl if @year < 2022
creates a seven day workfile and sets the sample include years prior to 2022.
Cross-references
Within-year cumulative sum (year-to-date).
Syntax: @ytd(x, y[, s])
x: series
y: series
s: (optional) sample string or object
Return: series
Cumulative sum of series x within each year, subject to limitations imposed by the workfile or optional sample.
This function is panel aware.
Examples
If x is a series of monthly profits, then
show @ytd(x)
returns a linked series of year-to-date monthly profits.
Cross-references