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

st: RE: AW: Week data, daily data, and end-of-year

From   "Sauermann J (ROA)" <>
To   "''" <>
Subject   st: RE: AW: Week data, daily data, and end-of-year
Date   Wed, 2 Dec 2009 15:05:30 +0100

Thanks for the hint! Sorry, but I didn't find this post before... It helped a lot to understand Stata's week definition

My (definitely not the most elegant) solution was to manually shift the daily information, collapse it by weeks, and then simply matching it to the weekly datasets.

As an example for 2009: the first day of the first week of 2009 (in my data) is December 29, 2008 (Monday). In order to match it appropriately with the first week defined by Stata (first 7 days of 2009 starting with January 1, 2009), I added "3" to all dates starting with December 29, 2008 (i.e. that it is read by Stata as being January 1, 2009). You can do the same with the previous years: 2008 (+1), 2007 (no change necessary). 

Though it seems to work properly, it does not really solve the problem, especially with years which have 53 weeks (normal Calendar) or one week with more than 7 days (Stata).

Best regards, 


-----Original Message-----
From: [] On Behalf Of Martin Weiss
Sent: woensdag 2 december 2009 13:40
Subject: st: AW: Week data, daily data, and end-of-year


You want to peruse before


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Sauermann J
Gesendet: Mittwoch, 2. Dezember 2009 13:39
An: ''
Betreff: st: Week data, daily data, and end-of-year

Dear Statalist, 

I have a dataset containing week information. The variable --week-- is
generated from a year variable (2008, 2009) and a week variable (1,...,52).
Weeks are defined as calendar weeks, i.e. always ranging from Monday until
Sunday. The week "1" of a year are thus a whole week (Mon-Sun) where at
least 4 days are in the new year (i.e. for the past two years, week "1"
overlaps new year's eve).

Stata defines week "1" as the first 7 days in the new year, i.e. January
1-January 7, irrespective of the weekdays. December 31, 2008 (Wednesday) was
for instance week "2547" while January 1, 2009 (Thursday) was week "2548". 

Next to the weekly data, I have an additional dataset which is based on
daily data. To use it properly, I transformed it using Stata to weekly data.
This obviously gives wrong results since the week break in Stata may be in
the middle of the week, while the week break in my weekly data is

Is there any way to tell Stata to use a date format where week "1" of a year
is the first week with at least 4 days in the new year?

[I guess one solution would be to manually generate own week counters which
can be matched properly]

Many thanks in advance,


Jan Sauermann

Research Centre for Education and the Labour Market
Maastricht University | ROA
P.O. Box 616, NL-6200 MD Maastricht
T +31 43 3883801 F +31 43 3884914

*   For searches and help try:

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index