Hi
I have data which have merchant names but mispelled texts. which is becoming hard while joining this table with other table on basis of merchant name. im trying to replace the text with first row in the group. if first 10 characters are same.
Data Have;
input merchant_name $20.;
cards;
future retail pvt. ltd.
future retail limited
future retail ltd
osborne corporation
osborne corp ltd
;
run;
desired output should be like
future retail pvt. ltd.
future retail pvt. ltd.
future retail pvt. ltd.
osborne corporation
osborne corporationthanks
Like this?
data HAVE;
input MERCHANT_NAME $40.;
cards;
future retail pvt. ltd.
future retail limited
future retail ltd
osborne corporation
osborne corp ltd
run;
data WANT;
set HAVE;
length PREV $40;
retain PREV;
if MERCHANT_NAME =: substr(PREV,1,10) then MERCHANT_NAME=PREV;
else PREV=MERCHANT_NAME;
run;
| MERCHANT_NAME |
|---|
| future retail pvt. ltd. |
| future retail pvt. ltd. |
| future retail pvt. ltd. |
| osborne corporation |
| osborne corporation |
Like this?
data HAVE;
input MERCHANT_NAME $40.;
cards;
future retail pvt. ltd.
future retail limited
future retail ltd
osborne corporation
osborne corp ltd
run;
data WANT;
set HAVE;
length PREV $40;
retain PREV;
if MERCHANT_NAME =: substr(PREV,1,10) then MERCHANT_NAME=PREV;
else PREV=MERCHANT_NAME;
run;
| MERCHANT_NAME |
|---|
| future retail pvt. ltd. |
| future retail pvt. ltd. |
| future retail pvt. ltd. |
| osborne corporation |
| osborne corporation |
Thanks a ton Sir.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.