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.
There is a section for ISO formats.
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.
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
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.