10-07-2015 05:59 PM
Im trying to reformat column DateA to column DateB. The tricky part is there are characters in the column, ie "Not Applicable", so SAS is reading the whole column as character. I tried many different ways but they don't seem like working. So I wonder if it is possible to reformat date if there are characters in the column.
|Group E||Not Applicable||Not Applicable|
|Group G||Not Applicable||Not Applicable|
|Group I||Not Applicable||Not Applicable|
10-07-2015 06:19 PM
You can conditionally execute your code. This could be made a one-liner if you use ifn/ifc and/or if you apply ? to your input format, but I'll let you work those out
if dateb='Not Applicable' then dateb_converted=.;
else dateb=input(dateb, mmddyy10.);
10-08-2015 04:40 AM
As Reeza has pointed out, conversion is pretty simple, and just drop the "Not" values. However I would question firstly what those dates reflect, is it really MMDDYY, or DDMMYY? Secondly why dates in DateA do not have the padding zero. Looks a bit fishey if you ask me, I would check the source data.