05-29-2018 09:35 AM
For the last week I have been using SAS VA for visualization purposes. Now I am hoping to convert strings expressed in ISO8601 interval format, such as "-PT20M" and "PT24H", to time (preferable) or numeric format so that "-PT20M" would be -00:20:00 in time format or just -20 in numeric format and respectively "PT24H" would be 24:00:00 or 24. Answers presented here are only applicable to base SAS situations.
I am starting to wonder whether I have to implement some sort of IF ELSE fix...I hope not...
Thank you for your answers in advance.
05-29-2018 09:43 AM
There is a section for ISO formats.
05-29-2018 12:10 PM
Hello @RW9 and thank you for your swift reply!
I'm afraid that I have already looked into that page and found it useless because firstly it doesn't provide information about their usage and secondly because SAS VA only seems to support four formats for strings (uppercasing, putting the string in double quotes, taking it raw "$w.d" and a fourth I can't remember at the moment.
05-29-2018 12:30 PM
Sorry, can't help then as I don't use VA. In coding you would use formats like:
Don't even know if you can do coding in VA.
05-31-2018 06:05 AM
You should convert these duration values before loading the data to be used by Visual Analytics, since there are no operators within VA to handle this.
Find below an example on how to convert an ISO duration value into a SAS time value.
data test; infile cards; input iso8601_int : $32.; length newtime 8; call is8601_convert("du", "du", iso8601_int, newtime); format newtime time.; cards; -PT20M PT24H PT25H P3D ;
The $N8601B. informat converts a duration into a character representation, that later can be used with the CALL IS8601_CONVERT routine.
See also this paper https://www.pharmasug.org/proceedings/2012/DS/PharmaSUG-2012-DS22-SAS.pdf for additional information