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

Re: st: merge using interval data

From   "Owens, Douglas Hamilton" <[email protected]>
To   <[email protected]>
Subject   Re: st: merge using interval data
Date   Thu, 28 Oct 2004 20:30:29 -0000

I would put the smaller provider status data into a wide format, with two date
variables, one for contract start and one for contract stop. Then 

 sort individual startdate
 by individual: assert startdate>=stopdate[_n-1] if _n>1
 *if assert fails, which status do you want to use?
 ren startdate date
 merge individual date using Big_Data
 sort individual date 
 by individual: replace stopdate = stopdate[_n-1] if _merge==2
 by individual: replace providerstatus = providerstatus[_n-1] ///
  if _merge==2 & date<=stopdate

*   For searches and help try:

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