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: defining a generic date variable with occasional 53-week years
From
"Dimitriy V. Masterov" <[email protected]>
To
Statalist <[email protected]>
Subject
st: defining a generic date variable with occasional 53-week years
Date
Thu, 22 Jul 2010 10:56:21 -0400
I am working with a dataset where I am forced to use a peculiar
calendar system: some years have 53 weeks. This means that the %tw
format does not always work. I've been using the following hack to get
around this:
egen time = concat(year week), p(w);
sencode time, replace;
format time %tg;
Unfortunately this is not ideal because different datasets cover
different periods, so time==1 will refer to different dates in
different datasets. This makes merging by time difficult.
Is there a way to construct a generic date variable from
numerical/string components that would alllow for dates like 2009w53,
but with a constant base period? Or is there another way to deal with
this problem?
Dimitriy
*
* 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/