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 (June 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 21 Jun 2006 12:01:09 -0400
Reply-To:   Lorne Klassen <lk1@ROGERS.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Lorne Klassen <lk1@ROGERS.COM>
Subject:   Challenging DATA Step Problem

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


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