| Date: | Tue, 8 Jan 2008 00:06:23 +0800 |
| Reply-To: | raveencobra@INBOX.COM |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
|
| From: | Raveendra Perumal <raveencobra@INBOX.COM> |
| Subject: | Re: Data manipualation help |
| Content-Type: | text/plain; charset=UTF-8 |
DATA NEW;
SET OLD;
IF -N- EQ 1 THEN DO;
OUTPUT;
PRE EQ B;
END;
ELSE DO;
IF A GT PRE THEN DO;
OUTPUT;
PRE EQ B;
END;
END;
RETAIN PRE;
RUN;
NOTE: IN THIS CODE, THE VARIABLE -N- MUST HAVE UNDERSCORE, NOT - . SINCE I DONT HAVE UNDERSCORE SYMBOL IN MY MOBILE, I USED - .
- RAVEEN
-----Original Message-----
From: Suren <suren3781@YAHOO.COM>
Sent: 2008-01-07 23:52:13 GMT+08:00
To: SAS-L@LISTSERV.UGA.EDU
Subject: [SAS-L] Data manipualation help
Hello,
I have a problem on data manipulation. The data is arranged on following
way:
A B
00 11
02 19
04 24
06 23
13 28
25 39
31 45
31 43
35 56
46 50
I want to extract only those rows where the value in column A is greater
than the preceding values of column B that has been extracted. For example,
given that first row is selected, the other rows need to be selected only
when the value of column A is greater than the value of column B (i.e. 11)
of the preceding row that has been selected and so on. The output would
have to look something like this:
A B
00 11
13 28
31 45
46 50
I would very much appreciate any suggestions and help.
THANKS
SUREN
|