can someone help me understand this line?
MAT_NBR= prxchange('s/^(0*)//', -1,NBR);
Unless I am mistaken,
mat_nbr = remove the Matched Pattern in variable NBR , the value of times is –1, then matching patterns continue to be replaced until the end of source is reached.
Sequence: match all of the followings in order
BeginOfLine
CapturingGroup
GroupNumber:1
Repeat
0
zero or more times
=>>> remove Leading Zeros in the varible nbr
nbr = 0001 => mat_nbr=1
nbr= 001 01 => mat_nbr=1 01
Unless I am mistaken,
mat_nbr = remove the Matched Pattern in variable NBR , the value of times is –1, then matching patterns continue to be replaced until the end of source is reached.
Sequence: match all of the followings in order
BeginOfLine
CapturingGroup
GroupNumber:1
Repeat
0
zero or more times
=>>> remove Leading Zeros in the varible nbr
nbr = 0001 => mat_nbr=1
nbr= 001 01 => mat_nbr=1 01
The function call removes leading zeros if starting at the first character. Is equivalent to prxchange("s/^0+//", 1, NBR). Note that prxchange("s/^\s*0+//", 1, NBR) would account for leading spaces.
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.