Kudoes to anyone who can figure out why this is not working!! (I can't)
I am converting a sas date to a sas datetime. Simple enough, right?
format work_datetime datetime23.3;
BUT.....when I use almost the same code in a merge step, it does not work. In fact, the answer it does give is very interesting, though wrong.
(I am NOT showing the whole merge step, way too complicated)
The value, adf_user_field_5 comes back as a certain number of hours minutes and seconds in January 1st 1960.....if you figure out the total number of seconds that those hours minutes and seconds represent is is EQUAL to the sas date value of workout_date.
Your code looks OK. Suspect your problem is elsewhere. Put a put statement at the beginning an end of the DO group for diagnostics. You may need to simply the program to the point that you can show it all.
As was suggested, adding a PUT (or PUTLOG _ALL_; with SAS 9) will help but then also if the SAS LENGTH for the DATETIME (numeric variable, time in seconds since 1/1/1960 - minimum length of 7, better to be 8 with STORE_CLOCK values) variable is truncated, you will not see evidence of a problem until a subsequent PROC or DATA step, where the variable is referenced.
Another self-initiated desk-checking technique by the OP would be to perform a PROC CONTENTS on the file immediately after the assignment "step", to verify/inspect the SAS NUMERIC variable "length" attribute for the DATETIME variable.
Also, consider that declaring a SAS FORMAT is not the equivalent of declaring a SAS LENGTH (either as a statement or as a keyword for the ATTRIB statement) -- your SAS variable may still be truncated without warning.