How do I get the wanted dataset by matching on ID? Dataset 1 ID Cases (0=Control, 1= Case) Injury date Start of follow up 1 0 Aug21,2009 Aug21,2011 2 1 Jan23,2007 Jan23,2009 Dataset 2 ID Visits to doctor 1 Sept2,2009 1 Oct30,2011 1 Dec1, 2011 2 Feb7, 2000 2 Feb15, 2010 Data wanted in the following format: (only interested in visits that are after the follow-up date. So once I get the desired table below, I basically have to create a count of how many visits a person has had once follow-up starts, for each of the cases and controls ID Cases (0=Control, 1= Case) Injury date Start of follow up Visits to doctor 1 0 Aug21,2009 Aug21,2011 Sept2,2009 1 0 Aug21,2009 Aug21,2011 Oct30,2011 1 0 Aug21,2009 Aug21,2011 Dec 1, 2011 2 1 Jan23,2007 Jan23,2009 Feb 7, 2000 2 1 Jan23,2007 Jan23,2009 Feb 6, 2010
... View more