Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Extending weekly data to daily data


From   "JP Azevedo" <[email protected]>
To   <[email protected]>
Subject   st: RE: Extending weekly data to daily data
Date   Thu, 26 May 2005 04:54:47 -0300

What about trying:

/* this bit only generates a demo dataset with 5 observations */
clear
set obs 5
gen id = _n
gen weekvar = _n+ 10
format weekvar %twmY


/* the next 5 lines do the trick */
expand 7
bysort id : gen dayvar = dofw(weekvar) if _n==1
sort id  dayvar
bysort id  : replace dayvar = dayvar[_n-1]+1 if dayvar==.
format dayvar %-d

I hope it helps.
Cheers,
JP



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of MA V
Sent: 25 May 2005 22:44
To: [email protected]
Subject: st: Extending weekly data to daily data

Dear all---
My question is the following:
I have weekly data (weeks are in stata format) and I would like to convert 
it to daily data. This means that each of the observations will have to be 
repeated 7 times. Is there an easy way of doing this in Stata?
Thanks,
MA_V

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
*   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/

*
*   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/



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