|
"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
|