BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DeepakSwain
Pyrite | Level 9

Hi there,

For your kind information, I am trying to remove \X0A\ with a space from my text "string" using perl in base sas.

Can someone modify my code to make it functional. Although I can use tranword funtion to do so but my desire is to use perl because in future by using escape character function, I will able to use it in variety of other situations in text mining.

 

I am using the following code: [for text substituion=s/pattern/new text/]

 

data test2;

set test1;

 string= prxchange("s/\/X0A\/ /",-1,string);

run;

 

Thank you in advance for your kind reply.

 

Regards,

Deepak

Swain
1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

If those \X0A\ are actual characters then

prxchange("s/\\X0A\\/ /io", -1, string)

will work. Note I assumed it is a zero between X and A. Correct if needed. 

PG

View solution in original post

7 REPLIES 7
PGStats
Opal | Level 21

 

 

prxchange("s/\x0a/ /o", -1, string)
PG
DeepakSwain
Pyrite | Level 9
It contains the actual string for example: "Nothing abnormality\X0A\ is detected." . It may be noted that there is "\" both before and after X0A. which has to be removed also.
Swain
data_null__
Jade | Level 19

Does the string contain the actual sequence /X0A/ or does it contain the character='0A'x aka ascii character 10?

 

 

DeepakSwain
Pyrite | Level 9
It contains the actual string for example: "Nothing abnormality\X0\ is detected."
Swain
DeepakSwain
Pyrite | Level 9
It contains the actual string for example: "Nothing abnormality\X0A\ is detected."
Swain
PGStats
Opal | Level 21

If those \X0A\ are actual characters then

prxchange("s/\\X0A\\/ /io", -1, string)

will work. Note I assumed it is a zero between X and A. Correct if needed. 

PG
DeepakSwain
Pyrite | Level 9
Hi there, it works fine. Thanks a lot.
Swain

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1155 views
  • 1 like
  • 3 in conversation