LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 3 Dec 2008 16:19:57 -0500
Reply-To:   Sid N <nsid31@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Sid N <nsid31@GMAIL.COM>
Subject:   Matching and reordering substrings

Hi,

I am trying to match the order of letters (separated by commas) in Column1 with Column2. The correct matches are the ones with only one letter in Column1 (eg., "a" matched with "One", "b" with "Two", "c" with "Three" and so on). When there are multiple letters (for eg., "a, c, e" as in ID 10), the substrings in Column2 are not correctly matched. Please post any suggestions on reordering the substrings in Column2 so as to match the letter order in Column1.

Input: ====== ID Column1 Column2 1 a One 2 b Two 3 d Four 4 a, d Four, One 5 e Five 6 b, c, d Three, Four, Two 7 c Three 8 a, b, c, d One, Three, Four, Two 9 a One 10 a, c, e One, Five, Three

Required output: ================ ID Column1 Column2 1 a One 2 b Two 3 d Four 4 a, d One, Four 5 e Five 6 b, c, d Two, Three, Four 7 c Three 8 a, b, c, d One, Two, Three, Four 9 a One 10 a, c, e One, Three, Five

Thank you in advance.

Sid


Back to: Top of message | Previous page | Main SAS-L page