Dear readers,
I am currently working with a dataset where I have a company ID, the
date, and a consumption variable.
I am working in panel and, for each day, I need to generate a variable
that is the difference between the current value of consumption, and
its value one year before. (It's like an annual change).
This stata code looks like that:
generate difference = consumption - l364.consumption
The issue is that my dataset is built using calendar days. Thus, very
often, the l.364.consumption is nul because firms do not produce /
spend money during the week-ends.
I was wondering if it exists a command in panel that would
automatically tell stata to take the closest existing variable if
l364.consumption is nul. Can I also restrict that to a limited number
of days (e.g 3 or 5 days before the current date) ?
Thanks in advance
--
Thomas Bourveau
thomas.bourveau@gmail.com
0637573925
*
* 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/