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 (November 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 25 Nov 2007 18:07:17 +0000
Reply-To:     Paul Dorfman <sashole@BELLSOUTH.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <sashole@BELLSOUTH.NET>
Organization: PDC
Subject:      Re: ZIPSTATE function, turn off invalid argument NOTE?
Comments: To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>


I would abstain from using the function at all if your purpose is indeed to return the state from the first 3 zip digits, the reason being two-fold:

1. The correspondence between int(zip/100) and state is not unique. For example, a simple

select * from (select distinct put (int(zip/100), z3.) as zip3, statecode as st from sashelp.zipcode) group zip3 having count(*) > 1


zip3 st ------- 063 CT 063 NY 834 ID 834 WY 969 GU 969 MP 969 PW

Hence I have to take issue with your description of what the function does. It accepts the full zip as its argument for a reason - a full zip corresponds to a unique state.

2. The function does not validate zip codes. Hence, if you need accuracy (and I presume you do) you had better use sashelp.zipcode to emulate the function via a format or hash, which would tangentially also eliminate the log notes issue you started with. Ideally, sashelp.zipcode being used should be freshly updated from the data set whose location is referenced in the SAS documentation:

Kind regards ------------ Paul Dorfman Jax, FL ------------

-------------- Original message ---------------------- From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET> > > The ZIPSTATE function evaluates the first three digits of a zip code (the > zone) and returns the state that corresponds to the zone. > > data x; > do zip = 0 to 1e5 by 1e2; > state = zipstate(zip); > if state eq '' then put zip= state=; > end; > run; > > When a zipcode is in invalid there is the following in the log: > NOTE: Invalid argument to function ZIPSTATE at line # column #. > > Is there a way to turn this note off, and leave other notes on ? > > Looking for something like the ?? of INPUT(), such as > input ('ABC', ?? 3.) > which prevents _error_ from being assigned. > > > > -- > Richard A. DeVenezia

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