@hernan_AR wrote:
this is the regex
s/(^.*)(SomeAlphaNumPrefix)([\d]+)(\.sas7bdat)$/$3/
with this, I get the digits between the prefix and the extension to the end
because I just need the digits, discarding the rest
do you see anything wrong here ?
Yes. The pattern is NOT accounting for the trailing spaces that will be padded onto a fixed length variable so that its length matches the defined length of the variable. You could for example do something like:
s/(^.*)(SomeAlphaNumPrefix)([\d]+)(\.sas7bdat\ *)$/$3/
Note if you want the last word in a line use the SCAN() function with -1 as the index. Much easier (and faster) then REGEX.
extension = scan(row,-1,'.');
oh, good to know it
that's why communities llike this are great!
thanks
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 save with the early bird rate—just $795!
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.