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: creating unified set of dates
From
stef salvez <[email protected]>
To
[email protected]
Subject
st: creating unified set of dates
Date
Fri, 15 Jun 2012 21:34:12 +0100
Dear all,
I have a panel data set like the one below
clear all
input id str8 (dates) variable
1 "23/11/08" 2
1 "28/12/08" 3
1 "25/01/09" 4
1 "22/02/09" 5
1 "29/03/09" 6
1 "26/04/09" 32
1 "24/05/09" 23
1 "28/06/09" 32
2 "26/10/08" 45
2 "23/11/08" 46
2 "21/12/08" 90
2 "18/01/09" 54
2 "15/02/09" 65
2 "16/03/09" 77
2 "12/04/09" 7
2 "10/05/09" 6
end
the start and end date of the time series for countries 1 and 2 are
different. For example, for country 1 the time series begins on
"23/11/08" while for country 2 the time series begins on "26-10-2008”.
My data on prices are available every 28 days (or equivalently every 4
weeks). But in some cases I have jumps (35 days or 29 days instead of
28 days). For example from the above table we have such jumps: from
"28/12/08" to "28/12/08" , from 22/02/09" to "29/03/09", etc
My goal is to have a unified sequence of dates across countries. So,
to achieve this I want to apply two solutions (Nick, it was you that
you proposed them!)
1) to interpolate the dates to a common set of dates (with the
distance between successive dates be 28 days)
2)I to take what I have and calculate monthly average prices and also
report how many prices those averages are based on. I suppose that I
will still have gaps and may well need to interpolate.
Please, I would be grateful to you if you could provide the exact code
in order to achieve these 2 goals. I should not ask this but If I am
not in the position of creating this unified sequence of dates I will
not be able to do the analysis that I want. Suggestions are welcome
but not very helpful as I am not very familiar with stata and I am
afraid that I will never make it on my own.
thank you for your understanding
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/