Hello, I was given a dataset where are the dates are originally in character format. To my dismay, I just discovered that not all the dates in my dataset are complete. While the majority (I hope) of the dates include a year, month, and day, some only include month, and some only include year, for example: 20070311 200812.. 2009.... This is a really big problem for me since the dates comprise my study's desired outcome. In order to troubleshoot this, is there a way to convert dates in character form to formatted dates in three different forms (year+month+day, year+month, and year only)? That way if the date converts to a missing value in one format, I can crosscheck to see if it is because it is an incomplete date. Alternatively I was reading about ways to deal with incomplete dates in SAS but I am worried that if I don't understand the process, I will introduce mistakes into my dataset. I tried something like this, but this code needs to at least be tweaked before it will work, and I am not sure it is the best solution: data clean.eHARS; set clean.eHARS; dx_dt_day=input(hiv_aids_dx_dt,YYMMDD10.); format dx_dt_day YYMMDD10.; dx_dt_mon=input(hiv_aids_dx_dt,YYMMDD10.); format dx_dt_day MONYY.; dx_dt_year=input(hiv_aids_dx_dt,YYMMDD10.); format dx_dt_day YEARw.; ; run; Any help would be very much appreciated. Thanks so much in advance!
... View more