I have numeric date and time variables that I would like to combine into a single numeric datetime variable. The code below works on some of the data, but not all of it (more specifically it won't calculate a datetime for any row where the time variable has a two digit hour - see example output below Proc SQL code). The SAS log gives two notes: "Invalid year value" and "Invalid argument to function INPUT. Missing values may be generated." I have tried changing the datetime informat of the input statement but that doesn't help. Any suggestions on how to fix this using Proc SQL (I'm using SAS 9.2) would be appreciated. proc sql ;
select a.injury_date
,a.injury_time
,input(put(a.injury_date,date9.)||put(a.injury_time,time8.),datetime17.) as injury_datetime format = datetime19.
from injury_data ; injury_date injury_time injury_datetime 14SEP2006 1:40:00 14SEP2006:01:40:00 29JUN2006 21:02:00 . 02AUG2006 16:31:00 . 02OCT2006 9:44:00 02OCT2006:09:44:00
... View more