*! version 1.0.0 23jun2016

Title

holdingrets -- calculates the holding period return of one or more price variables.

Syntax

holdingrets varlist [if] [in]

Description

holdingrets calculates the holding period return of one or more price variables specified in the varlist. It is assumed that the dataset is sorted chronologically.
The way the holding return is calculated for each variable is as follows. For each variable, the holding period return is calculated as the percentage change
between the last non-missing value and the first non-missing value. This command performs a casewise deletion (it drops observations with at least one missing
value for any of the variables).

Remarks

Check the "Also See" Menu for related commands.

Examples

Collects online daily stock data from Yahoo Finance for 2014 and 2015.

. returnsyh AAPL MSFT, fm(1) fd(1) fy(2014) lm(12) ld(31) ly(2015) frequency(d) price(adjclose)

Calculates the holding return of both stocks for the whole period.

. holdingrets p_adjclose_AAPL p_adjclose_MSFT

Calculates the holding return of both stocks from the first day of Jan 2015 to Dec 31, 2015.

. holdingrets p_adjclose_AAPL p_adjclose_MSFT if period>=td(01jan2015) & period<=td(31dec2015)

Stored results

holdingrets stores results in r() in the following scalar and matrix (vertical vector):

Scalars

r(N): Number of observations used for the calculations

Matrix

r(holdingrets): (n x 1) holding period returns of each price variable (n variables)

Author

Carlos Alberto Dorantes, Tecnológico de Monterrey, Querétaro Campus, Querétaro, México.
Email: cdorante@itesm.mx