Tranwrd option to not leave space?

Accepted Solution Solved
Reply
Super Contributor
Posts: 418
Accepted Solution

Tranwrd option to not leave space?

Hello everyone. I am trying to remove one string (the letters TRD_ ) from a secondary string. The issue I have is that tranwrd always leaves a space in the resulting word, which I cannot have (I also can't string spaces because the words have other spaces I Need).

For example, I would like the following to happen.

CL_TRD_Borrower Name  =CL_Borrower Name.

TRD_Answer one  =Answer One.

What I am getting is

CL_TRD_Borrower Name  =CL_ Borrower Name.

TRD_Answer one  = Answer One.

Is there an option I am not aware of to do this?

Thanks!

Brandon


Accepted Solutions
Solution
‎12-03-2013 10:53 AM
Respected Advisor
Posts: 3,799

Re: Tranwrd option to not leave space?

Posted in reply to Anotherdream

TRANSTRN

data _null_;
  
x = 'CL_TRD_Borrower Name';
   z = transtrN(x,
'TRD_',trimn(' '));
   put (_all_)(=);
   run;

View solution in original post


All Replies
Solution
‎12-03-2013 10:53 AM
Respected Advisor
Posts: 3,799

Re: Tranwrd option to not leave space?

Posted in reply to Anotherdream

TRANSTRN

data _null_;
  
x = 'CL_TRD_Borrower Name';
   z = transtrN(x,
'TRD_',trimn(' '));
   put (_all_)(=);
   run;
Super Contributor
Posts: 418

Re: Tranwrd option to not leave space?

Posted in reply to data_null__

Thank you kindly. I knew this was possible!

Respected Advisor
Posts: 3,799

Re: Tranwrd option to not leave space?

Posted in reply to Anotherdream

You could also use TRANWRD to change to something unique and then compress the unique character.  TRANSTRN is better.

Super Contributor
Posts: 418

Re: Tranwrd option to not leave space?

Posted in reply to data_null__

yeah that's actually what I was doing. I was using tranwrd to put it to the hyphenated a in unicode, and then compressing that value, but I figured there HAD to be an easier way to do it so I figured I'd ask the experts.

Glad I did. Thanks again!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 524 views
  • 0 likes
  • 2 in conversation