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 (May 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 22 May 2003 14:45:03 -0400
Reply-To:   "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:   Re: Concatenate columns

"VJ" <vjoshi73@YAHOO.COM> wrote in message news:200305221716.h4MHGk915318@listserv.cc.uga.edu... > Hi, > I have a dataset with ~ 200 columns(Word1--Word200). > Dataset looks like below : > ID Word1 Word2 Word3 Word4 -------- Word200 > 1 Sql Oracle Java > 2 Sql Java > 3 SQL ORACLE Jave > > What I would like is to have a dataset that looks like this: > > ID Words_found > 1 Sql, Oracle, Java > 2 Sql, Java > 3 Sql, Oracle > > I know I could just concatenate all these fields and use the compbl > function etc..but does anyone have a suggestion for a more efficient way to > do this? > > Thanks in advance for your help. > Vaishali

Something like this should do it. Normalize and filter word[i] as needed. - tweakedWord = upcase(substr(word[i],1,1)) || lowcase (substr(word[i],2)); Not sure why at Id=3 'Jave' value is excluded from words_found.

array word word1-word200; length words $1000;

i = 1; firstword = 1; do while (i <= 200); if word[i] ne ' ' then do; if firstword then do; words = word[i]; firstword = 0; end; else words = trim(words) || ',' || word[i]; end; i+1; end;

-- Richard A. DeVenezia, http://www.devenezia.com


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