SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
sfffdg
Obsidian | Level 7

Hi,

 

I have to replace PQR  and -00(basically the number after hyphen ,  - 00 should alsoconsider if any spaces after hyphen  and before 00) to space.

address=  "7 12-00 ABC XYZ RD PQR BEACH QLD 1234".

 

I have used the below expression  to replace PQR with  space.

prxchange('s/\b(PQR)\b//i',-1,address).

 

Neeed help with how to replace -00(should alsoconsider any spaces between hyphen and 00)

 

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Your need is unclear. Like this?

prxchange('s/\b(PQR|-\s*\d*)\b/ /i', -1, ADDRESS).

 

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 627 views
  • 0 likes
  • 2 in conversation