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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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