BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

@Pandu2 wrote:

Could your code work if table T2 has this kinda data, if it doesn't may I know how to make it work. 

data T2;
  input ItemNo :$10. (ItemC1 - ItemC5) (:$8.);
datalines;
A101  MRF:123 . . Ceat:789 .
A100  MRF:098 .  Ceat:453  . . 
B01   IRP:126 . . . CRO:670
B0101 IRP:309 CRO:012  . . .
;

Same rules and same concept.

I suspect you are asking to match on the part before the colon instead of the full string?  If so that will require changing how you match.  For example you could not use IN or WHICHC() to match since those are exact matches.  You could perhaps use SCAN() to pull out the part before the colon.

whichc(t1.itemc1,scan(t2.itemc1,1,':'),scan(t2.itemc2,1,':'), ...

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
  • 30 replies
  • 3153 views
  • 0 likes
  • 6 in conversation