Date: Fri, 9 Oct 1998 10:13:22 -0400
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: Ordering word tokens
Content-Type: text/plain
> > From: Robert Lokhamp [SMTP:rlokhamp@WORLDNET.ATT.NET]
> > In the course of a linguistic study, I've created a data set WORDS with
> > 10 character variables W1-W10. It looks something like that:
> > W1 W2 W3 W4 W5 W6 W7 W8 W9 W10
> > HUMPTY DUMPTY SAT ON A WALL
> > HUMPTY DUMPTY HAD A GREAT FALL
> I am trying to
> > find an effective way of replacing the data set with one where the
> > tokens would be in alphabetic order like
> > W1 W2 W3 W4 W5 W6 W7 W8 W9 W10
> > A DUMPTY HUMPTY ON SAT WALL
> > A DUMPTY FALL GREAT HAD HUMPTY
>
I think you want to sort the words in each observation.
Check out the ordinal function;
the documentation should read:
The ORDINAL function returns the
"Nth-sized item in the ascending list"
so you might use
array word {*} $ W1-W10;
array wordsort {*} $ X1-W10
do I = 1 to dim(word);
wordsort{I} = ordinal(I,of word{*}); end;
Ron Fehd the macro maven CDC Atlanta GA
|