What you should do is convert this datetime string in your raw data into a SAS datetime value. The challenge you have is that the way your datetime string looks like is kind of unusual: AM/PM is a US American way of writing a date - but then the datepart of your string is DMY and not MDY. There is no SAS ready made informat to convert such a string into a SAS datetime value (which is a numeric value containing the number of seconds since 1/1/1960). A 2 step approach is needed: First read the data as string, then use the query builder and in the advanced expression builder convert the string to a form as interpretable by a standard SAS Informat (mmddyyyy hh:mm:ss AM|PM), then read this string using a informat which will convert the string to a SAS datetime value. You then also need to apply a format to the output variable in order to make the numeric value (the seconds since 1/1/1960) human readable. The format could be "Datetime21." If you need the formated datetime value to look exactly as you specified it (ddmmyyyyy hh:mm:ss AM|PM) then again there is no standart SAS Format for this. You would need to define your own format using the code Alpay provided (the picture format). You would need to run this code in a code node before you then can use it in the query builder. Below the nested function creating a SAS datetime value out of your raw data datetime string - to be used in the query builder advanced expression: input(prxchange('s/(\d{2}\/)(\d{2}\/)(.*)(AM|PM)/$2$1$3 $4/oi',1,t1.F16),mdyampm25.2) And last but not least: The huge advantage in converting the string to a SAS datetime value is that you then can use calender functions with it (like intnx(), intck(), datepart()....).
... View more