Hello, I have a variable that is supposed to be a 24 hour time variable, but it comes in as 1445 or 936 or 40. Ultimately, I'll need a new column that is AM or PM and I need another column to read only the hour in a 12 hour clock (i.e. I need 1445 to change to 2, 936 to become 9, and 40 to become 12). I have been able to make the AM and PM column, but unable to get the time to convert to a time format, let alone down to only the hour from a 12 hour clock. This is what I have currently data want; set Have; if Time < 1200 then AMPM='AM'; else AMPM='PM'; If Time = 9999 *this indicates no value available* Then AMPM = ' '; IF DINJHRMNG = 9999 then DINJHRMNG = .; Run; data want2; set want; format Time HHMM.; Time2=put(input(Time, time8.),tod8.); run; Thanks!
... View more