I have a report that has a time value in excel formatted to MM: SS. (01:32; 00:56, etc)
When imported, they import as a text string. I need to convert it into a value that can be used in calculations. I've tried a couple of different methods to convert the text string. (Including changing the string to HH:MM: SS format) But every method I've tried to use to convert it returns null value and the Invalid numeric data, Time='00:26' error.
Can someone help me with the correct method to convert a time text string to a value that can be used for calculations?
If you don't mind a message about conversion on the log, you could shorten your equations to:
myTime = 60* input(myTimeString, 2.) + scan(myTimeString, 2, ':');
myTime = input(myTimeString, time.);
myTime = input(myTimeString, time.);
format myTime time5,;
If you don't mind a message about conversion on the log, you could shorten your equations to:
myTime = 60* input(myTimeString, 2.) + scan(myTimeString, 2, ':');
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.