I have patient data in SAS that looks like this (I used CSV to make empty cells load easier):
pat_ID,visit_date,fp_1,fp_2,fp_3,fp_4,fp_5,fp_6,fp_7,fp_8,ini_dx, 87103,2/23/2010,,3E,,,,,,,2, 87103,1/16/1983,2D,,,,,,,,2, 87103,6/20/2005,9E,,,,,,,,2, 87103,3/18/2019,3E,,,,,,,,2, 87103,4/23/1992,,2D,4E,,,,,,2, 87103,7/25/1997,,,,6H,,,,,2, 61291,1/12/2019,2B,,,,,,,,4, 61291,2/19/2016,,,,,,,2D,,4, 61291,6/17/1994,7G,,,,,,,,4, 61291,8/30/1994,,2C,,,,,,,4, 61291,9/30/1999,4H,,,,,,,,4, 61291,11/11/1992,4H,,,,,,,,4, 61291,4/19/1983,,,,9F,,,,,4, 61291,8/13/1995,3D,,,,,,,,4, 61760,10/4/2016,,5C,,,,,,,5, 61760,11/10/2019,1F,,,,,,,,5, 61760,11/7/1989,,2D,,,,,,,5, 61760,8/10/2015,5H,,,,,,,,5, 30098,3/19/1996,,8H,,,,,,,1, 30098,10/3/2003,,8H,,,,,,,1, 30098,7/24/1990,2G,1F,,,,,,,1, 30098,3/13/1987,,,,4C,,,,,1, 30098,10/12/2013,9F,,,,,,,,1, 30098,6/8/1984,,,,,,,,,1, 30098,6/20/2013,4D,,,,,,,,1, 30098,1/6/1990,3A,,,,,,,,1, 27754,7/11/1986,,,6E,,,,,,8, 27754,3/18/1995,,,5C,,,,,,8, 27754,9/18/1988,,,,1B,,,,,8, 27754,8/15/2000,5E,,,,,,,,8, 27754,11/26/1986,4A,,,,,,,,8, 27754,8/17/2013,,2B,,,,,,,8, 27754,5/31/2008,,8G,,,,,,,8,
I want to search the follow up variables(fp_1 thru fp_8) for the initial diagnosis (ini_dx) and then to return the 'visit_date' as well as that value. For example, the first row for patient 87103 does not match initial diagnosis '2' but the second row does (fp_1 has '2D') so return that 'visit_date' and '2D'. How could I do this?
... View more