Date: Wed, 16 Oct 2002 12:28:54 -0700
Reply-To: shiling zhang <shiling99@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: shiling zhang <shiling99@YAHOO.COM>
Organization: http://groups.google.com/
Subject: Re: weird sort problem | programming challenge
Content-Type: text/plain; charset=ISO-8859-1
It can be as simple as the following codes with point access on a data set.
> Found more beer.
Pass it to me please.
data t1;
do y = 1 to 5;
output;
end;
run;
%macro shiftord(start);
data shift;
do i=1 to nobs;
point=mod(&start+i-1,nobs);
if point=0 then point=nobs;
set t1 point=point nobs=nobs;
output;
end;
stop;
run;
proc print;run;
%mend;
%shiftord(1)
%shiftord(2)
%shiftord(3)
%shiftord(4)
%shiftord(5)
evan.cooch@NOSPAMcornell.edu wrote in message news:<3dac8cea.590190@newsstand.cit.cornell.edu>...
> On Tue, 15 Oct 2002 21:01:03 GMT, evan.cooch@NOSPAMcornell.edu wrote:
>
> >Must be late in the day, or the beer has run otu. One or the other ;-)
> >
>
> Found more beer.
>
> data test;
>
> input x;
>
> cards;
>
> 1
>
> 2
>
> 3
>
> 4
>
> *;
>
>
>
> data hold;
>
> set test;
>
>
>
> %macro looper;
>
>
>
> %do i=1 %to 4;
>
>
>
> data top;
>
> set hold end=last;
>
> if last;
>
> run;
>
>
>
> data bottom;
>
> set hold end=last;
>
> if last then do; delete; end;
>
>
>
> data hold;
>
> set top bottom;
>
>
>
> proc print noobs data=hold;
>
> title 'frame-shifted data file';
>
>
>
> %end;
>
>
>
> %mend;
>
>
>
> %looper;
>
> run;
>
>
> Works like a charm.