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,':'), ...

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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