Date: Thu, 5 Feb 2004 16:34:57 GMT
Reply-To: Lars Wahlgren <lars.wahlgren.pleasenospam@STAT.LU.SE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lars Wahlgren <lars.wahlgren.pleasenospam@STAT.LU.SE>
Organization: Lund university, Sweden
Subject: Re: create a new variable that indicate a change
Jesper
There is also a DIF-function that can be used instead of LAG
data test ;
set test ;
by id ;
Change = "No " ;
if not first.id & (dif1(amount) ne 0) then Change = "Yes" ;
run ;
---------------
Lars Wahlgren
Lund university
"Jesper Nyholm" <jesper_nyholm@POST.TELE.DK> skrev i meddelandet
news:200402051535.i15FZtB07266@listserv.cc.uga.edu...
> /***
> Hi
> Can anybody tell me how to create a new variable that indicate a change
> in amount for every id?
> ***/
> DATA TEST;
> INPUT ID 1-5 AMOUNT 7-11;
> DATALINES;
> 10001 2000
> 10001 2000
> 10001 3000
> 10002 2500
> 10002 3000
> 10003 1000
> 10003 1000
> 10003 1000
> 10003 2000
> 10003 1000
> ;
|