I have a large dataset (600k records), with possible date info in multiple of four distinct columns (admin_date1, admin_date2, admin_date3, admin_date4). I need to find the first and last of the four options. firstdate = min (admin_date1, admin_date2, admin_date3, admin_date4); lastdate = max (admin_date1, admin_date2, admin_date3, admin_date4); then I create a new column referencing contents of firstdate and lastdate: if firstdate+21>lastdate then (.) else Completedate=lastdate+14; The process works for 99+% of the records, but a small percentage return completedate of 01/01/1960. These invariably have valid firstdate and lastdate data, but somehow screw up he completedate. I can find no common denominator for why it sometimes works and sometimes doesn't. I've tried to strong-arm a solution via Excel, using an "if" statement, and placing a blank in the cell when there is no appropriate value. However, when importing data back into SAS, it won't recognize the new column in date format. I have copied and pasted contents within Excel using "keep data only," thus eliminating the if statement (even though I'm pretty sure I've imported dates previously generated through 'if' statements), to no avail- SAS still reads it as character data and won't reformat as date. How can I fix one or both of these issues?
... View more