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 (January 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 23 Jan 2008 16:31:44 +0100
Reply-To:     Stefan Pohl <stefan.pohl@ISH.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Stefan Pohl <stefan.pohl@ISH.DE>
Subject:      Merge postal codes until a criterion is fulfilled
Content-Type: text/plain; charset="us-ascii"

Hi SAS-group,

I have a list of postal codes which have to fulfill a special criterion1: crit1>100, each postal code has an id, I know the distances between the postal codes dist1-dist4:

Post.Code Crit1 id | dist1 dist2 dist3 dist4 1067 54 1 | 0 2.5 1.76 8.37 1069 120 2 | 2.5 0 3 8.6 1097 80 3 | 1.76 3 0 4 1099 150 4 | 8.37 8.6 4 0

Crit1 is violated for the ids 1 and 3! I have to merge postcal codes which have the smallest distance between each other until crit1 is fulfilled. The smallest distance to postal code 1067 is dist3=1.76, i.e. id = 3, i.e. I have to merge postal code 1067 with postal code 1097. Then crit1=134 > 100. Then I introduce the crit2 and an additional regional code

Post.Code Crit1 id | dist1 dist2 dist3 dist4 | Crit2 Reg.Code 1067 54 1 | 0 2.5 1.76 8.37 | 134 10671097 1069 120 2 | 2.5 0 3 8.6 | 120 1069 1097 80 3 | 1.76 3 0 4 | 134 10671097 1099 150 4 | 8.37 8.6 4 0 | 150 1099

The regional code is trim(post.code1!!postcode2) with postcode1 < postcode2.

How can I manage this task?

Thank you for any help.

Stefan.


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