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

Re: st: merge using interval data


From   Richard Goldstein <[email protected]>
To   [email protected]
Subject   Re: st: merge using interval data
Date   Mon, 25 Oct 2004 16:25:04 -0400

the reason not to do what Kit suggested is that there are multiple records/provider as there is a new contract at least once per year
(of course, I suppose that I could "fix up" the provider file and
then do this ....)

Rich

Kit Baum wrote:

Rich wrote

> The issue: I have two data sets, one large (gigabytes) with
> individual data including a unique id and a date of occurrence
> of a service being provided.
>
> I need the status of the provider on the date of occurrence
> for each case. I have a second data set that includes, for
> each provider their status as of a period of time (e.g.,
> a beginning and ending date for a contract).
>
> I need to merge the two so that the provider's status is
> included in the individual data set.
>
> The only solution I currently see involves expanding the
> provider data set so each possible data (from the beginning
> of the contract to the end) is covered and then merging the
> two data sets (using the nokeep option). However, this
> strikes me as inefficient.
>

I presume the individual dataset indicates which provider was involved with the individual record. If so, why not just merge the two datasets on provider, which should leave you with something like

indivID dateService providerID providerStart ProviderEnd

Then you can just generate status = ( providerStart <= dateService <= ProviderEnd )
and drop the start and end variables... (Yes, that is not a Stata statement, but you know what I mean)

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html

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