Date: Fri, 23 Feb 2001 16:28:49 -0000
Reply-To: Nigel.Pain@SCOTLAND.GSI.GOV.UK
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nigel Pain <Nigel.Pain@SCOTLAND.GSI.GOV.UK>
Subject: Re: Record counter that sort of goes round a clock
Content-Type: text/plain; charset="iso-8859-1"
How about:
Data numbered;
set unnumbered;
thenewvar = mod(_n_,16);
if thenewvar = 0 then
thenewvar = 16;
run;
***************************************************
Nigel Pain
Scottish Executive Development Department
Business Support Unit
Victoria Quay
EDINBURGH
EH6 6QQ
UK
Tel +44 131 244 7237
Fax +44 131 244 7281
Mailto:nigel.pain@scotland.gsi.gov.uk
Website: http:\www.scotland.gov.uk
> -----Original Message-----
> From: mark.k.moran@CENSUS.GOV [mailto:mark.k.moran@CENSUS.GOV]
> Sent: 23 February 2001 15:07
> Subject: Record counter that sort of goes round a clock
>
>
> I have a dataset in SAS 6.12 which is in a specified sort order, and I
> simply need to create a new variable that counts down the
> rows of records
> 1, 2, 3, ... , 16, and then with the 17th record, goes back
> to 1, 2, 3, ...
> , 16, and so on every time it's completed 16 records
> consecutively. In
> other words,
>
> TheNewVar Which record
> 1 1
> 2 2
> 3 3
> 4 4
> ... ...
> 15 15
> 16 16
> 1 17
> 2 18
> 3 19
> ... ...
> 15 31
> 16 32
> 1 33
> 2 34
> etc.
>
> Any ideas?
>
> - Mark
>
|