Re: Generating an index, but forcing it to start at a particular point

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Generating an index, but forcing it to start at a particular point

Sibusiso Moyo
Dear all,

To generate an index count from 1 to whatever one can use:

Compute index = $casenum.

But what if I want to start at say -20 to -2?

Any ideas?

Sibusiso.
Reply | Threaded
Open this post in threaded view
|

Re: Generating an index,

Richard Ristow
At 11:44 AM 6/16/2006, Sibusiso Moyo wrote:

>To generate an index count from 1 to whatever one can use:
>
>Compute index = $casenum.
>
>But what if I want to start at say -20 to -2?

There's always simple addition:

COMPUTE INDEX  = $casenum - 21.

If you want your first index value to be #START, say -20, and your
increment to be #BY, say -2, you can write

COMPUTE #START = -20.
COMPUTE #BY    = -2.

COMPUTE INDEX = #START + #BY($CASENUM-1).

However, since this IS simple, I'm probably misunderstanding you ...
Reply | Threaded
Open this post in threaded view
|

Re: Generating an index, but forcing it to start at a particular point

Jason Burke
In reply to this post by Sibusiso Moyo
COMPUTE index = $CASENUM - 20 .


HTH,

Jason

On 6/17/06, Sibusiso Moyo <[hidden email]> wrote:

> Dear all,
>
> To generate an index count from 1 to whatever one can use:
>
> Compute index = $casenum.
>
> But what if I want to start at say -20 to -2?
>
> Any ideas?
>
> Sibusiso.
>