*! version 1.2.0 1May2014

*! version 1.1.0 6Oct2010

*! version 1.0.0 15may2010

help for epiweek and epiweek2 (Tim Chu)

Title

epiweek -- Generating epidemiological week and epidemiological year from calendar date

epiweek2 -- Generating calendar date from epidemiological week and epidemiological year

Syntax

epiweek varname [if] [in] , epiW(newvarw) epiY(newvary)

epiweek2 varname , Start(newvarw) End(newvary)

Description

epiweek creates epidemiological week and equivalent
epidemiological year from the calendar date. US CDC and WHO definition
the epidemiological week as:

Each epidemiological week begins on a Sunday and ends on a Saturday.
The first epidemiological week of year ends on the first Saturday of January,
provided that it falls at least four or more days into the month.

epiweek2 converts epidemiological week and epidemiological year to
the calendar date with the starting Sunday and the ending Saturday in the week.

It needs to note:

1. Before running the epiweek program, calendar date need to assign as
"%td" type.

2. Before running the epiweek2 program, variable with epidemiological week and
year needs to assign as "string" type and format as four digit
years following with character "W" and one or two digits for the week. for example, 2014w2.

Example

Setup

. webuse dow1

Create new variables epi_week and epi_year from calendar date

. epiweek date, epiw(epi_week) epiy(epi_year)

Create new variables - calendar date with starting Sunday from and ending Saturday to

. egen wy = concat(epi_year epi_week), p(w)

. epiweek2 wy, s(from) e(to)

Author

Tim Chu

Epidemiologist/Biostatistician

Vancouver Coastal Health

Vancouver, Canada

tim.chu@vch.ca