Date: Mon, 9 Feb 2004 09:20:38 -0800
Reply-To: Tomasz <zombek_1@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tomasz <zombek_1@YAHOO.COM>
Organization: http://groups.google.com
Subject: If first/if last or? - data step question
Content-Type: text/plain; charset=ISO-8859-1
Hi,
I have a data set:
id amt
1 50
1 20
1 50
1 0
1 0
1 0
1 0
2 10
2 15
2 0
2 0
2 0
3 0
3 0
3 0
I need:
id amt indicator
1 50 0
1 20 0
1 50 0
1 0 0
1 0 0
1 0 1
1 0 0
2 10 0
2 15 0
2 0 0
2 0 0
2 0 1
3 0 0
3 0 0
3 0 1
In other words I need a variable Indicator that says '1' when amt=0
occurs for the third time in a row (for every id).
I am not sure whether a function similar to first. and last. exists
like if second. if third.
Any helpfull sugestions will be appreciated.
Tom
|