| Date: | Thu, 22 May 2003 17:40:19 +0100 |
| Reply-To: | JC Dashper <johndashper@SELECTIVE.CO.UK> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | JC Dashper <johndashper@SELECTIVE.CO.UK> |
| Subject: | Re: Adding 1 to Numeric Value |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
Try this:
DATA LIST LIST /ID(A2) SEQ .
BEGIN DATA
AA 1255555
BA 1255556
CA 1255557
DA .
EA .
FA .
END DATA.
LIST.
DO IF (MISSING(seq)=0) .
COMPUTE seq2 = seq .
ELSE.
COMPUTE seq2=LAG(seq2)+1.
END IF.
MATCH FILES FILE=*
/RENAME seq = seqX
/RENAME seq2 = seq
/DROP=seqX.
EXECUTE .
Regards
John Dashper
************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender or system manager.
*************************************************************
Selective Marketplace Limited
Registered Office: Belton Road West, Loughborough, Leics. LE11 5XL
Registered in England No. 1566688
*************************************************************
-----Original Message-----
From: First Last [mailto:my_ls_account@yahoo.com]
Sent: 22 May 2003 17:21
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Adding 1 to Numeric Value
Hello,
The following sample contains ID (SORTED by ID) and
SEQ variables. I would like to fill in (for only
blank/missing SEQ values) by adding +1 to the maximum
value in the SEQ variable. I would like the resultant
data to look like:
AA 1255555
BA 1255556
CA 1255557
DA 1255558 (previous MAX+1)
EA 1255559 (previous MAX+1)
FA 1255560 (previous MAX+1)
I tried this (IF MISSING(SEQ) SEQ=1+MAX(SEQ).) but did
not get any results.
Thank you.
***********************
DATA LIST LIST /ID(A2) SEQ .
BEGIN DATA
AA 1255555
BA 1255556
CA 1255557
DA .
EA .
FA .
END DATA.
LIST.
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
|