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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 5003 views
  • 0 likes
  • 6 in conversation