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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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