LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Jul 2005 19:06:01 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: R&D with LAG and RETAIN
Comments: To: chang_y_chung@hotmail.com
In-Reply-To:  <MC5-F73XOjr4D1mmlyt0021922a@mc5-f7.hotmail.com>
Content-Type: text/plain; format=flowed

Ah my good friend Chang is correct one will have to reset the retained variable to encompass teh case of going over ID boundaries. I was in the process of writing just such an email. Thanks Chang.

data two ; set one ; by ID ; retain last ;

if first.id_num then last = . ;

if Given = . then Given = Last ;

Last = Given ; run ;

Should fix it.

Toby Dunn

From: Chang Chung <chang_y_chung@HOTMAIL.COM> To: Toby Dunn <tobydunn@HOTMAIL.COM> Subject: Re: R&D with LAG and RETAIN Date: Wed, 6 Jul 2005 14:48:24 -0400

On Wed, 6 Jul 2005 18:34:00 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:

>Badrish, > >Fear not !!! SAS-L is here!!! okay enough cuteness for one day... > >data two ; >set one ; >retain last ; > >if Given = . then Given = Last ; > >Last = Given ; >run ; > > > >Toby Dunn

Badrish's dataset has id's -- you have to refresh the last variable when going over the id boundary.


Back to: Top of message | Previous page | Main SAS-L page