KSharp,
Would you explain your regular expression? Appreciated, Art
Art
/'\s*\d{4}\s*-\s*\d{1,2}\s*-\s*\d{1,2}\s*'/o
\s* means matching zero or more times SPACE character.
\d{4} means matching exactly four digits.
\d{1,2} means matching one to two times digits(i.e. \d or \d\d)
o means only compiling perl regular expression once.
- means matching exactly - character.
' means matching exactly ' character
Ksharp
Message was edited by: xia keshan
Just for the fun of it:
data want(keep=line);
set have;
line=prxchange("s/'(\d{4})-(\d+)-(\d+)'/%nrbquote(%)sysfunc(inputn($3$2$1,ddmmyy8.))/o", -1, line);
run;
Patrick.
It is very interesting. I don't realize that changing it into a macro function.
But there is a problem. Your way will make line longer, if the length of original line is not long enough to hold these macro function. then it will be truncated.
Anyway, It is an interesting solution.
Happy Christmas !
Ksharp
Cheers
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.