Lee Chuntao replying to Alexander Severinsen:
> I think you can run the following code:
> gen year = int(date/10000)
> gen month = int((date-year*10000)/100)
> gen day = date-10000*year-100*month
> replace date = mdy(month, day, year)
> gsort id -date
> by id: gen obs_num = _n
>
> iis id
> tis obs_num
> tsset id obs_num
>
> by id: gen distance = l.date-date
> gen ratea = purchase/distance
> by id: gen rateb=sum(ratea)
No problem, but see
Is there any difference between using tsset and
iis and tis before xt commands?
http://www.stata.com/support/faqs/stat/tsset.html
Nick
[email protected]
*
* 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/