Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Converting monthly values to quarterly averages

From   Christopher Baum <>
To   "" <>
Subject   Re: st: Converting monthly values to quarterly averages
Date   Thu, 21 Feb 2013 12:14:53 +0000

On Feb 21, 2013, at 2:33 AM, Anusha wrote:

> I have data at a monthly frequency by industry across years and would like to create quarterly averages by industry and year. I tried the tscollap command after specifying that the data was a panel and get an error that time-series operators not allowed. Please advise.

The latest version of -tscollap- is on SSC. The help file reads:

tscollap is for use with time-series data of monthly, quarterly, or half-yearly
frequency.  You must tsset your data before using tscollap; see help tsset.
If the data are a panel of timeseries (i.e. if a panelvar has been specified
in tsset) the specification of the panel identification variable will 
automatically be retained in the resulting dataset (it need not, and should not,
be specified in the varlist).  Time-series operators may not be used. 

As indicated, you must -tsset- the monthly data. The ym(year,month) function can be used to combine a year and month number into a single variable, and you can then tsset panelvar ymvar, monthly. 

As the help file says, you cannot include time-series operators in the -tscollap- varlist, but that would not stop you from creating something like dx = D.x and specifying that variable. 


Kit Baum   |   Boston College Economics & DIW Berlin   |
                             An Introduction to Stata Programming  |
  An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index