Date: Fri, 9 Oct 1998 10:49:53 -0400
Reply-To: "F. Joseph Kelley" <jkelley@ARCHES.UGA.EDU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "F. Joseph Kelley" <jkelley@ARCHES.UGA.EDU>
Subject: Re: Ordering word tokens
In-Reply-To: <360C4667.580F6BA8@worldnet.att.net>
Content-Type: TEXT/PLAIN; charset=US-ASCII
You will probably find many methods of doing this, here is one ..
data test ;
infile cards missover ;
array vars {10} $ 15 w1-w10 ;
retain obsno 0 ;
obsno + 1 ;
keep obsno word ;
input
W1 $ W2 $ W3 $ W4 $ W5 $ W6 $ W7 $ W8 $ W9 $ W10 $ ;
do i = 1 to dim(vars) ;
word = vars{i} ;
if word = '' then delete;
else output ;
end ;
cards ;
HUMPTY DUMPTY SAT ON A WALL
HUMPTY DUMPTY HAD A GREAT FALL
ALL THE KINGS HORSES AND ALL THE KINGS MEN
CANNOT PUT HUMPTY DUMPTY TOGETHER AGAIN
;
proc sort data=test ;
by obsno word ;
data next ;
set test;
by obsno ;
retain subscr nw1-nw10 ;
keep obsno nw1-nw10 ;
array words {*} $ 15 nw1-nw10 ;
if first.obsno then subscr = 1;
else subscr + 1 ;
words{subscr} = word ;
if last.obsno then output ;
proc print ;
run;
|