Date: Tue, 20 Jan 2004 07:17:04 +0000
Reply-To: Kit Leung <kit_leung03@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kit Leung <kit_leung03@HOTMAIL.COM>
Subject: Question on first. and last.variable
Content-Type: text/plain; format=flowed
Hi,
I have a question regarding the first.variable and last.variable question.
Basically, my data have 2 or more types with the same ID (in my example, I
just showed two types). I will need to create a flag variable that if the
record has both A & B type, I will need to flag it to "BOTH" like scenario 1
& 2. If it has only one type, the flag variable will just show the type
like scenario 3 & 4. By using first and last variable, I had no problem to
flag scenario 3 & 4 but I didn't know how to handle scenario 1 & 2.
Thanks.
Scenario 1:
ID TYPE FIRST_TYPE LAST_TYPE FINAL
1234 A 1 0 BOTH
1234 A 0 1 BOTH
1234 B 1 1 BOTH
Scenario 2:
ID TYPE FIRST_TYPE LAST_TYPE FINAL
1234 A 1 0 BOTH
1234 A 0 1 BOTH
1234 B 1 0 BOTH
1234 B 0 1 BOTH
Scenario 3:
ID TYPE FIRST_TYPE LAST_TYPE FINAL
1234 A 1 0 A
1234 A 0 0 A
1234 A 0 1 A
Scenario 4:
ID TYPE FIRST_TYPE LAST_TYPE FINAL
1234 B 1 0 B
1234 B 0 1 B
_________________________________________________________________
Let the new MSN Premium Internet Software make the most of your high-speed
experience. http://join.msn.com/?pgmarket=en-us&page=byoa/prem&ST=1