|
Here's the problem in words:
Groupings are based on the var CIRC1. If within a CIRC1 group all the CIRC2
values are identical AND all the CIRC3 values are identical AND all the
CIRC4 values are identical, then STATUS should be set to 60 for the first
record in the CIRC1 group and set to 61 for all other records in the CIRC1
group.
If within a CIRC1 group not all of the CIRC2 values are identical AND/OR
not all of the CIRC3 values are identical AND/OR not all of the CIRC4
values are identical, then STATUS should be set to 62 for all records in
the CIRC1 group.
If there is only one record in the CIRC1 group then STATUS should remain 1.
Here's an example showing tables:
Input table:
CIRC1 CIRC2 CIRC3 CIRC4 STATUS
----- ----- ----- ----- ------
11111 AAAAA 44444 DDDDD 1
11112 AAAAB 44442 DDDDB 1
11112 AAAAB 44442 DDDDB 1
11112 AAAAB 44442 DDDDB 1
11113 AAAAB 44444 DDDDD 1
11113 AAAAB 44444 DDDDE 1
11113 AAAAC 44444 DDDDE 1
11113 AAAAC 44444 DDDDE 1
11114 AAAAD 44445 DDDDF 1
11115 AAAAA 44446 DDDDE 1
11115 AAAAA 44446 DDDDE 1
11115 AAAAA 44446 DDDDX 1
Output table:
CIRC1 CIRC2 CIRC3 CIRC4 STATUS
----- ----- ----- ----- ------
11111 AAAAA 44444 DDDDD 1
11112 AAAAB 44442 DDDDB 60
11112 AAAAB 44442 DDDDB 61
11112 AAAAB 44442 DDDDB 61
11113 AAAAB 44444 DDDDD 62
11113 AAAAB 44444 DDDDE 62
11113 AAAAC 44444 DDDDE 62
11113 AAAAC 44444 DDDDE 62
11114 AAAAD 44445 DDDDF 1
11115 AAAAA 44446 DDDDE 62
11115 AAAAA 44446 DDDDE 62
11115 AAAAA 44446 DDDDX 62
BY vars? SQL? Multiple passes through the data?
Thanks in advance
|