Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: limiting time series data fills based on duration between observations


From   Ethan StataQ <ethan.stataq@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: limiting time series data fills based on duration between observations
Date   Thu, 4 Jul 2013 23:20:02 -0400

I have data that looks like this:

Company       Employees     YearMonth
ABC              10,000            2010m1
ABC              10,100            2010m2
ABC              9,500              2010m5
ABC              9,600              2010m12
DEF               2,000             2009m5
DEF               2,100             2009m10
DEF               2,300             2009m11

I would like to create a time series of this data such that the number
of employees is presumed to remain unchanged during the months between
observations. However, if the number of months between observations
exceeds 3 months then I do not want to make this assumption. In this
case the number of employees should be represented as "." instead such
that the above data appears as follows:


Company       Employees     YearMonth
ABC              10,000            2010m1
ABC              10,100            2010m2
ABC              10,100            2010m3
ABC              10,100            2010m4
ABC              9,500              2010m5
ABC              .                     2010m6
ABC              .                     2010m7
ABC              .                     2010m8
ABC              .                     2010m9
ABC              .                     2010m10
ABC              .                     2010m11
ABC              9,600              2010m12
DEF              2,000              2009m5
DEF               .                    2009m6
DEF               .                    2009m7
DEF               .                    2009m8
DEF               .                    2009m9
DEF               2,100             2009m10
DEF               2,300             2009m11


The idea is that I presume the number of employees remains the same as
the last reading as long as a new reading occurs within 3 months.

I would really appreciate some help in figuring out how to achieve
this. If this question has been answered, a redirect url would be
greatly appreciated.

Thank you!
Ethan
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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