Stata 15 help for _tsnatscale

Title

[P] _tsnatscale -- Obtain nice label or tick values for time series

Syntax

_tsnatscale #_min #_max #_n, { daily | weekly | monthly | quarterly | halfyearly | yearly }

Description

_tsnatscale returns in r() "nice" values for labeling or ticking of the range #_min to #_max in approximately #_n steps. The unit of time that represents the range is taken into account to choose tick values that fall on "nice" time boundaries.

Stored results

_tsnatscale stores the following in r():

Scalar r(n) number of values chosen r(min) first value to label or tick r(max) last value to label or tick r(delta) (r(max)-r(min))/r(n)) r(list) (for Daily and Weekly)

For stored results, you will either be presented with r(delta), if the ticks are a fixed distance between each other, such as with years, or you will be presented with r(list), which is a list of tick values. For example, r(list) is necessary when tick values are measured in days, but ticked on monthly boundaries.

The values to tick (if r(delta) is present) are r(min), r(min)+r(delta), r(min)+2*r(delta), ..., r(min)+(r(n)-1)*r(delta).

Otherwise, values to tick (if r(list) is present) are the values contained in r(list).


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