Can someone help. I have a data with dates entered in STRING format. I will like to change in into the TIME format. I can do that in SPSS but failed to do it in SAS. The Data is in the form hh:MMS. When I checked the data using proc contents, it shows that the Times are in STRING format. This is how the data looks like: I tried to multiply TIME by 1, it did not work.
You can try the format time8. to convert the string to time number format.
But keep in mind that the output here which you get as a number will be the number of seconds starting from 1 Jan 1960 00:00:00
input timevar $10.;
Please check the following output.
With SAS, your variables are either CHARACTER or NUMERIC type with an optional output FORMAT -- this can be identified with a PROC CONTENTS output report. The code example provided should properly convert your CHARACTER variable data string to a SAS NUMERIC type variable, where you would then need to apply a SAS FORMAT statement in your code.
If unsuccessful, suggest you share what SAS log you have demonstrating where the code is not working.