Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: merging files using date variables


From   Leny Mathew <[email protected]>
To   [email protected]
Subject   st: merging files using date variables
Date   Mon, 14 Jun 2010 11:47:30 -0400

Hello Everyone,
                       I have two files that I would like to merge.
The first file has an ID number, beginning and end dates of
eligibility for Medicaid. This is the ‘master file’.  These dates can
span a few days to a few months. For the same ID number there can be
many rows of eligibility, ie, a person can come in and out of
eligibility over the course of many years. The data is in long format.
I have the DOB of the patients, and can create an age variable that
would be unique for each beginning date of eligibility.

The second file has the ID number, and the date of a claim. This is
the ‘using file’ in terms of the merge command jargon.  Here also for
the same ID, there can be many rows of claims over the course of many
years. The file is in long format. Although there is a beginning and
end date for a claim, in 99.5% of cases it is the same date. There can
be many claims on the same date if there were multiple procedures done
on the same day. I created an age variable for this file also but that
is not unique due to the multiple claims on the same date.

I’m trying to merge these files so that within each ID the claims are
attached to the corresponding periods of eligibility. I was hoping to
use ‘nearmrg’ using the age variable but that doesn’t work due to the
non-uniqueness of the variable in the ‘using file’.  The only other
way that comes to mind is to create variables for each of the months
of eligibility for all the years for each ID and use all of them to
merge the files. This will be cumbersome and if I can avoid it by a
simpler method it would be great.  Any comments or suggestions are
greatly appreciated.

Thank You,

Leny

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index