BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
raigner
Calcite | Level 5

Dear All,

i hope someone can help me: 

I have two datasets that I would like to connect to each other.
In dataset A there are AEs listed and in the variable AECMNO the corresponding CMs (2, 3, 26, 27, 28, 29, 30, 31, 32,33,34).
In dataset B, these CMs should be found in the variable CMSPID.
I have tried the following statement. unfortunately a: not all hits are listed and b. 1 wrong hit is listed.

proc sql;
create table AE_CM
as select * from test_AE as A left join cm as B on A.SubjectId=B.SubjectId where (AECMNO contains CMSPID);
quit;

 

thank you for your help

 

raigner_1-1672823816400.png

 

raigner_2-1672823872636.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Could try this one :

from test_AE as A left join cm as B on A.SubjectId=B.SubjectId and findw(AECMNO,strip(CMSPID),' ,');

View solution in original post

2 REPLIES 2
Ksharp
Super User
Could try this one :

from test_AE as A left join cm as B on A.SubjectId=B.SubjectId and findw(AECMNO,strip(CMSPID),' ,');
raigner
Calcite | Level 5

Thank you very much it works really precisely.

 

best

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
  • 2 replies
  • 905 views
  • 0 likes
  • 2 in conversation