Stata 15 help for tsappend

[TS] tsappend -- Add observations to a time-series dataset

Syntax

tsappend, { add(#) | last(date|clock) tsfmt(string) } [options]

options Description ------------------------------------------------------------------------- * add(#) add # observations * last(date|clock) add observations at date or clock * tsfmt(string) use time-series function string with last(date|clock) panel(panel_id) add observations to panel panel_id ------------------------------------------------------------------------- * Either add(#) is required, or last(date|clock) and tsfmt(string) are required. You must tsset or xtset your data before using tsappend; see [TS] tsset and [XT] xtset.

Menu

Statistics > Time series > Setup and utilities > Add observations to time-series dataset

Description

tsappend appends observations to a time-series dataset or to a panel dataset. tsappend uses and updates the information set by tsset or xtset. Any gaps in the dataset are removed.

Options

add(#) specifies the number of observations to add.

last(date|clock) and tsfmt(string) must be specified together and are an alternative to add().

last(date|clock) specifies the date or the date and time of the last observation to add.

tsfmt(string) specifies the name of the Stata time-series function to use in converting the date specified in last() to an integer. The function names are tc (clock), tC (Clock), td (daily), tw (weekly), tm (monthly), tq (quarterly), and th (half-yearly).

For clock times, the last time added (if any) will be earlier than the time requested in last(date|clock) if last() is not a multiple of delta units from the last time in the data.

For instance, you might specify last(17may2007) tsfmt(td), last(2001m1) tsfmt(tm), or last(17may2007 15:30:00) tsfmt(tc).

panel(panel_id) specifies that observations be added only to panels with the ID specified in panel().

Examples with time-series data

--------------------------------------------------------------------------- Setup . webuse tsappend1

Display how data are currently tsset . tsset

Display general information about the dataset . describe, short

Add 12 observations to end of dataset . tsappend, add(12)

Display general information about the dataset . describe, short

--------------------------------------------------------------------------- Setup . webuse tsappend1, clear

Display how data are currently tsset . tsset

Add observations through the first month of 2001 . tsappend, last(2001m1) tsfmt(tm)

Display how data are currently tsset . tsset ---------------------------------------------------------------------------

Examples with panel data

--------------------------------------------------------------------------- Setup . webuse tsappend3, clear

Describe pattern of xt data . xtdescribe

Display summary information for t2 by id . by id: summarize t2

Add 6 observations to each panel (panels not ending at a uniform date) . tsappend, add(6)

Describe pattern of xt data . xtdescribe

Display summary information for t2 by id . by id: summarize t2

--------------------------------------------------------------------------- Setup . webuse tsappend2, clear

Add observations through the seventh month of 2000 (panels ending at a uniform date) . tsappend, last(2000m7) tsfmt(tm)

Display summary information for t2 by id . by id: sum t2 ---------------------------------------------------------------------------

Stored results

tsappend stores the following in r():

Scalars r(add) number of observations added


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