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

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 782 views
  • 0 likes
  • 2 in conversation