Date: Sun, 10 May 2009 20:41:53 -0400
Reply-To: Wensui Liu <liuwensui@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Wensui Liu <liuwensui@GMAIL.COM>
Subject: Re: keep value from previous iteration
In-Reply-To: <200905110037.n4AKQ32o005340@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
you are THE man, Art!
thank you so much!
On Sun, May 10, 2009 at 8:37 PM, Arthur Tabachneck <art297@netscape.net> wrote:
> Wensui,
>
> Is the following all you are looking for?:
>
> data have;
> input x;
> cards;
> 1
> 2
> 3
> 4
> ;
>
> data want;
> set have;
> retain last_x;
> output;
> last_x=x;
> run;
>
> Art
> ---------
> On Sun, 10 May 2009 20:25:22 -0400, Wensui Liu <liuwensui@GMAIL.COM> wrote:
>
>>Dear All,
>>I know it is relatively simple but just can't find an elegant and
>>simple solution with retain statement.
>>here is what I have.
>>1
>>2
>>3
>>4
>>here is what i want
>>1
>>2 1
>>3 2
>>4 3
>>
>>I don't want to use lag() function or hash and just want to know a way
>>in datastep with retain.
>>thank you so much!
>>--
>>==============================
>>WenSui Liu
>>Acquisition Risk, Chase
>>Blog : statcompute.spaces.live.com
>>
>>Tough Times Never Last. But Tough People Do. - Robert Schuller
>>==============================
>
--
==============================
WenSui Liu
Acquisition Risk, Chase
Blog : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do. - Robert Schuller
==============================
|