*! version 1.1.0 14aug2019

Title

cpiget -- Constructs an annual CPI series based on a user-specified fiscal-year time span.

Syntax

cpiget
newvar ,
tstart(yyyy mm)
tend(yyyy mm)
bstart(yyyy mm)
bend(yyyy mm)
fymstart(mm)
fymend(mm)
[options]

where where newvar is the name of the CPI variable that is generated according to the options below.

Main
tstart(yyyy mm) beginning year and month of CPI download

tend(yyyy mm) end year and month of CPI download

bstart(yyyy mm) beginning year and month of CPI re-base period

bend(yyyy mm) end year and month of CPI re-base period

fymstart(mm) beginning month of fiscal year

fymend(mm) end month of fiscal year

Output
outdta(filename) specifies file to save CPI data (.dta)

Other
clear replace data in memory

preserve restore data in memory after retrieving CPI

fyrename(old_fy_name newvar_name) renames output variable fystart or fyend

Description

cpiget constructs an annual CPI data series based on a user-specified
fiscal-year time span. The CPI series is scaled such the monthly period spanned by
bstart(yyyy mm) and bend(yyyy mm) is equal to 100. This program uses
the import fred command introduced in Stata 15 to download monthly CPI data
from the St. Louis Federal Reserve Bank (FRED) data repository.

Motivation: Although inflation adjustment of annual data (in nominal USD) is often done using
an annual average of monthly CPI data over the calendar year, such an adjustment
is not necessarily appropriate when the fiscal year does
not align with the calendar year. As an example, annual district-level
school finance data usually span two calendar years: the fiscal year begins in July
of year t and ends in June of year t+1. In such a scenario, one may desire to
construct a CPI index that averages over the fiscal year - not the calendar year -
to transform nominal dollars into so-called real dollars.

In addition to returning a CPI series with name newvar, cpiget also generates
two additional variables: fystart and fyend. When the fiscal year
spans two calendar years, fystart corresponds to year t and fyend
corresponds to year t+1. If the fiscal year does not span two calendar years,
then fystart and fyend are identical. In an annual data set to which
CPI data are merged, the user decides whether merging on fystart or fyend is
appropriate.

When using cpiget with
option outdta(filename), the user will likely want to rename either fystart or fyend
to merge the CPI data with the year variable in the user's data set. To facilitate this merge,
use option fyrename(old_fy_name newvar_name), where old_fy_name is either
fystart or fyend.

Notes: The CPI series obtained in this program is CPIAUCNS, which is the non-seasonally
adjusted CPI-All Urban Consumers series.

Options

Main

tstart(yyyy mm) specifies the start year and month of the CPI series download from FRED. For example,
to request the series begins in January 1985, specify tstart(1985 1).

tend(yyyy mm) specifies the end year and month of the CPI series download from FRED. For example,
to request the series ends in December 2018, specify tend(2018 12).

bstart(yyyy mm) specifies the start year and month of CPI re-base period. The start year and month must
be between the start year and month and end year and month of the CPI series download.

bend(yyyy mm) specifies the end year and month of CPI re-base period. The end year and month must
be between the start year and month and end year and month of the CPI series download.

fymstart(mm) specifies the beginning month of fiscal year. If the fiscal year begins in July, then
specify the option as fymstart(7).

fymend(mm) specifies the end month of fiscal year. If the fiscal year ends in June, then specify the
option as fymend(6).

Output

outdta(filename) saves a dataset of annual CPI according to the user-specified fiscal year. Specifically,
filename.dta contains three variables: the CPI variable which has name newvar; a variable denoting the
fiscal year start; a variable denoting the fiscal year end.

Other

clear will replace the current data set in memory with the user-specified CPI series. This
option can not be specified simultaneously with preserve.

preserve obtains the user-specified CPI series without affecting the data in memory. This option
is best used with output(filename); see examples below.

fyrename(old_fy_name newvar_name) renames either fystart or fyend to a newvar_name that is specified by the user.

Examples

Example 1:

Obtain monthly CPI between January 1990 and December 2016.
Rebase the CPI such that July 2009 to June 2010 equals 100. Set the fiscal year
to begin in July (i.e., month 7) and end in June (i.e., month 6).

. cpiget cpi1, tstart(1990 1) tend(2016 12) bstart(2009 7) bend(2010 6) fymstart(7) fymend(6)

Example 2:

Load the nlswork data set. Then (1) obtain monthly CPI between January 1967 and December 1989; (2)
rebase the CPI such that July 1979 to June 1980 equals 100; (3) Set the fiscal year
to begin in July (i.e., month 7) and end in June (i.e., month 6); (4)
rename the fyend variable to year; (5) merge in the fiscal year cpi variable.

. webuse nlswork

. replace year = year + 1900

. tempfile cpitemp

. cpiget cpi2, tstart(1967 1) tend(1989 12) bstart(1979 7) bend(1980 6) fymstart(7) fymend(6) outdta(`cpitemp') fyren(fyend year) preserve

. merge m:1 year using `cpitemp'

Authors

Christopher A. Candelaria Kenneth A. Shores

Vanderbilt University Pennsylvania State University

chris.candelaria@vanderbilt.edu kshores@psu.edu

Note: If you have questions or suggestions about the program, please contact the authors.

References

If you use this program in your research, please kindly cite
the following:

Candelaria, C. A. & Shores, K. A. (Forthcoming). "Get Real! Inflation Adjustments of Educational Finance Data."
Educational Researcher.