Date: Thu, 20 Jul 2006 07:22:22 -0400
Reply-To: "Rickards, Clinton (GE Consumer Finance)"
<clinton.rickards@GE.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Rickards, Clinton (GE Consumer Finance)"
<clinton.rickards@GE.COM>
Subject: Re: information from a previous line
In-Reply-To: A<1153360035.390867.206620@m79g2000cwm.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Ross, try:
data matrixdata;
set matrixdata;
retain x2_saved;
if x2_saved=0 then x1=1;
x2_saved = x2;
run;
Clint
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Ross
Sent: Wednesday, July 19, 2006 9:47 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: information from a previous line
Hi Folks,
Suppose I want x1=1 in every observation if the previous observation
has x2=0.
How do I ask SAS the content of x2 in the previous obs? I tried with
retain but it considers x2 in the current observation, and not the
previous.
data matrixdata;
set matrixdata;
retain x2;
if x2=0 then x1=1;
run;
thanks!
Ross
|