/* You can convert your character datetime value to a SAS datetime variable by using the DHMS function. The date portion of a SAS datetime value needs to be in the form of ddmmmyy or ddmmmyyyyy in order to directly read the value with the DATETIME informat, so you will need to split the value into a separate date and time value to create a SAS date and SAS time value, then pass these to the DHMS function. The first thing you will do is to find the postion of the blank in between the character date and time value. This is done by using the INDEX function. The date portion is then converted to a SAS date by using the SUBSTR function to pick up the date from postion 1 to the position of the blank minus 1, then this is passed to the INPUT function using the MMDDYY10. informat. The time portion is converted to a SAS time value by using the SUBSTR function to pick up the time from the position of the blank plus 1 to the end of the value, then this is passed to the INPUT function using the TIME8. informat. The DHMS function expects 4 values, the first being a SAS date, followed by the hour, minute, and second values. Since SAS time values values are stored as total number of seconds, you can zero out the hour and minute positions of the DHMS function and pass the SAS time value in the seconds position. Finally, format the new datetime value with the DATETIME19. format. You need to specify at least a width of 19 in order for the datetime to be displayed with a 4-digit year. Here is an example: */ data test; infile datalines truncover; input dtime $19.; datalines; 1/9/1977 0:00:00 10/25/1999 15:00:30 ; data test2; set test; blankpos=index(dtime,' '); sasdtime=dhms(input(substr(dtime,1,blankpos-1),mmddyy10.),0,0, input(substr(dtime,blankpos+1),time8.)); format sasdtime datetime19.; *drop blankpos; put _all_; run; Title ORIGINAL DATA; Proc print data=test;run; Title Changed DATA; Proc print data=test2;run;