Nice dates, especially for time series graphs
nicedates [yvarlist] timevar [if exp] [in range] [ , n(#) ]
Description
nicedates shows a numlist of "nice" dates as determined by _tsnatscale for timevar, which is normally a time variable. nicedates examines the display format of timevar to determine whether it includes daily, weekly, monthly, quarterly, half-yearly or yearly dates. If in doubt, the guess will be yearly, which implies that nicedates will give sensible answers with numeric variables other than dates. The list of nice dates is accessible after nicedates as r(dates).
Other numeric variables yvarlist may also be specified. This may be useful if a variable includes missing values for early and/or late values of timevar, so that, for example, the time range of a graph will be less than that of timevar.
Options
n() suggests a number of "nice" dates to be returned. The default is 5.
Examples
. webuse wpi1 . nicedates wpi t . scatter wpi t, xla(`r(dates)')
Author
Nicholas J. Cox, University of Durham n.j.cox@durham.ac.uk
Also see
Online: help for _tsnatscale