BookmarkSubscribeRSS Feed
Ankitsas
Calcite | Level 5
Dude,


The code is as follows , you will get what you need:-

data store1;
input id product type $;
datalines;
1 112 refferal
2 112 approval
3 112 ship
4 113 ship
;
run;

data store2;
input product productname $;
datalines;
112 xyz
113 abc
115 def
;
run;

proc sort data=store1;
by product;
run;
proc sort data=store2;
by product;
run;

DATA store3;
MERGE store1(in=a) store2(in=b);
BY product;
if a;
RUN;
Ksharp
Super User
[pre]

data store1;
input id product $ type $;
datalines;
1 000112 refferal
2 000112 approval
3 000112 ship
4 000113 ship
;
run;

data store2;
input product $ productname $;
datalines;
112 xyz
113 abc
115 def
A15 def
;
run;
data store11;
set store1;
product=substr(product,verify(product,'0'));
run;

proc sort data=store11;
by product;
run;
proc sort data=store2;
by product;

DATA store3;
MERGE store11(in=one) store2;
BY product;
if one;
RUN;

[/pre]


Or



[pre]


data store1;
input id product $ type $;
datalines;
1 000112 refferal
2 000112 approval
3 000112 ship
4 000113 ship
;
run;

data store2;
input product $ productname $;
datalines;
112 xyz
113 abc
115 def
A15 def
;
run;
proc sql;
create table want as
select a.* ,b.productname
from store1 as a left join store2 as b on a.product contains strip(b.product)
;
quit;

[/pre]



Ksharp Message was edited by: Ksharp
brm
Calcite | Level 5 brm
Calcite | Level 5
Thanks everybody.......it worked.....sorry for the confusion.

Thanks,
brm.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 5927 views
  • 0 likes
  • 6 in conversation