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
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!
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.