LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (December 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 8 Dec 2007 18:15:52 -0500
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Replacing a Character variable with part of another Character
              variable

On Sat, 8 Dec 2007 14:58:19 -0800, Daniel Nordlund <res90sx5@VERIZON.NET> wrote:

>> -----Original Message----- >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of SAS >> Student >> Sent: Saturday, December 08, 2007 2:24 PM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: Replacing a Character variable with part of another Character variable >> >> Good evening all, >> >> I have a small problem that I need to solve and would appreciate any >> help you offer. >> I created the below table using some raw data. I created the Location >> variable using the >> ZIPCITY function. As you can see, in the last observation the City >> "Harrisbu" does not match the city under Location "Levittown" while >> for the first observation the Location is left blank because the >> zipcode is invalid. > >It will be a lot easier for people to help you if you provide a self-contained program that generates your sample data, rather than making them try to extract data from a poorly formatted email (everything is wrapping haphazardly at my end of the email).

http://www.puzha.com/sasbook/sas%20examples.html#_Toc145244126

> >That being said, is this just a toy problem or is this a real problem you are trying to solve. I ask, because ZIP codes are not geographical regions, but rather mail delivery routes. There are many places where the zipcode "location" does not match the town. In fact, sometimes even the state won't match. So I'm not convinced you should be editing anything. > >>I need a simple code that does the following: >> >> 1.If they zipcode does not match the city/state (6th observation), >> create a code that suggests either edits to the zipcode or city/state. > >What do you mean by create a code? It would be helpful if you took the sample data from your email and showed us what you would like the end result to be. > >> >> 2. If the Zipcode is invalid (1st observation) i need to replace its >> value with "???" > >How do you know that a ZIPCODE is invalid? Because location is blank? If you write back to SAS-L and show us what you want to end up with, someone will surely be able to give you some useful help (maybe even me :-). >Dan > >Daniel Nordlund >Bothell, WA USA


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