[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: merge/joinby wityh if condition
1) joinby is rarely the answer to a question. It is a quite
specialised tool corresponding to the outer join in database lingo.
It will not help you here; it would combine each obs on id (first ds)
with each obs on id (second ds) leading to observations belonging to
2) If you have single records in each database per id, it is a
straightforward one-to-one merge on the id field.
3) After merging you may apply the if condition to the result with
keep if start_date1<=start_date2 & end_date1>=end_date2
to screen out those observations not wanted.
Kit Baum, Boston College Economics
On Aug 13, 2005, at 2:33 AM, Taavi wrote:
Dataset 1 has variables:
id start_date1 end_date1 sum1
Dataset 2 has variables:
id start_date2 end_date2 sum2
I need to join/merge these files by variable id and a condition:
start_date1<=start_date2 & end_date1>=end_date2
* For searches and help try: