Hello,
I import an excel file, the data has the line breaks, so, sometimes ,in my sas data I have the multiple spaces.
I want to replace this spaces by ^n but my code doesn't work:
OBJECTIVES2=prxchange('s/(^|\b)\s{2,}(\b|$)/^n/oi',-1,OBJECTIVES);
Maybe you know some other options to do that?
Thank you for your help!
Best regards,
Marie
A space means \b is matched, so I am unsure what the intent of your expression is.
> I want to replace this spaces by ^n
Like this? It's the same as your expression.
OBJECTIVES2=prxchange('s/\s{2,}/^n/',-1,OBJECTIVES);
A space means \b is matched, so I am unsure what the intent of your expression is.
> I want to replace this spaces by ^n
Like this? It's the same as your expression.
OBJECTIVES2=prxchange('s/\s{2,}/^n/',-1,OBJECTIVES);
I would remove the line breaks from your data. That's only going to create problems "somewhere".
Below RegEx replaces one or multiple consecutive whitespace characters with a single blank.
OBJECTIVES2=OBJECTIVES;
OBJECTIVES2=prxchange('s/\s+/ /oi',-1,OBJECTIVES2);
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.