Create a Stata monthly date using
gen date = mofd(dofw(yw(year,weeks)))
Also, note that
egen meanwhatever = mean(whatever), by(date)
and similar commands will automatically
adjust for number of weeks assigned to
each month and missing values.
Nick
[email protected]
Thomas Speidel
> I have a dataset containing yearly and weekly data starting
> from week 1
> 1999 (i.e. week of Jan 1, 1999) to week 53. This is repeated
> from year
> 1999 to year 2004. I am trying to convert this data to monthly data,
> containing the total no. of units for each month of each year. The
> problem is all months (except some Februarys) contain a
> little more than
> 4 weeks, and so computing the total for each month is not
> straight-forward. I guess any solution will have to include
> some error,
> which is fine.
>
> Any ideas? Thanks for any suggestions.
>
> The following is a sample of my data:
>
> year weeks units
> 1999 1 600
> 1999 2 597
> 1999 3 588
> 1999 4 562
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/