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 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 20 Jul 2006 07:22:22 -0400
Reply-To:     "Rickards, Clinton (GE Consumer Finance)"
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Rickards, Clinton (GE Consumer Finance)"
Subject:      Re: information from a previous line
Comments: To: Ross <fed.rossi@GMAIL.COM>
In-Reply-To:  A<>
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;



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