BookmarkSubscribeRSS Feed
Laine
Fluorite | Level 6

Hello,

 

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.

4 REPLIES 4
Laine
Fluorite | Level 6

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, can't help then as I don't use VA.  In coding you would use formats like:

want=input(have,<format>);

Don't even know if you can do coding in VA.

BrunoMueller
SAS Super FREQ

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

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 4 replies
  • 2003 views
  • 0 likes
  • 3 in conversation