DATA Step, Macro, Functions and more

Remove Text

Reply
Occasional Contributor
Posts: 9

Remove Text

Hello,

 

I have identified an error in within an address field and want to remove it.

 

Within an address field 'address_1'  there is occassionally an error ' -- Please Select -- ' written within it.  Is there a way to remove this phase from the address field?

 

thanks

Sally

PROC Star
Posts: 1,561

Re: Remove Text

Like this?


data HAVE;
  ADDRESS_1= ' foo  -- Please Select --  faa ';
  ADDRESS_1=tranwrd(ADDRESS_1,'-- Please Select --','');
  putlog ADDRESS_1=;
run;

ADDRESS_1=foo     faa

PROC Star
Posts: 252

Re: Remove Text

May be something like this

data abc;

input addr_ln_1 $50.;
datalines;
 -- Please Select --1121 berkeley street
 7755 cambridge ave
;
run;

data bde;
set abc;
addr_ln_1=tranwrd(addr_ln_1,'-- Please Select --','');
run;
Ask a Question
Discussion stats
  • 2 replies
  • 107 views
  • 1 like
  • 3 in conversation