/* Usage notes for the $zipcods format. Created 7.30.97 */ /* Revised 2.3.99 */ To Access ========= Via anonymous FTP at: oseda.missouri.edu in directory: pub/sasfmats filename: Szipcods.sas Related files in same directory: zipcods.usgnotes (this file), zipfmats.usgnotes Other format module files with names beginning with "Sz". Via WWW at http://www.oseda.missouri.edu/mscdc/sasfmats/Szipcods.sas or, to view entire formats directory and choose files to browse/download: http://www.oseda.missouri.edu/cgi-bin/uexplore?/mscdc/sasfmats@secure or, for the more sophisticated user who would like to have access to the data this all came from, access the data using the hypercon and/or xtract applications via the URL: http://www.oseda.missouri.edu/cgi-bin/ sasapps.pl?dir=/mscdc/data/zipeq90x&dset=uszips&form=sasapps.html CAUTION: this URL is not intended for everyone. If you think "SQL Query" is way too technical then do NOT try this on your own. This is mostly for people who want to be selective about what data they get, want a machine-readable format, etc. What You Get ============ This format code returns a 64-character string of various geographic codes for all 5-digit U.S. ZIP codes in the 50 states + DC., based on the Census Bureau's 1990 ZIP-block equivalency files. As such, it covers only residential ZIP codes that existed circa October, 1991 and for which the Bureau published STF3 data on the 1990 STF3B files. Almost all of the fields are derived from the ZIP-Block equivalency file with one exception. The argument to the format table is the 5-digit ZIP. There are fewer than a dozen ZIPs that cross state boundaries. In these few cases the argument for the states after the first (the one with the largest portion of the 1990 population) require adding the state abbreviation to the argument. See the entry for 63673IL, for example. You should be aware that ZIP codes are not a very "well behaved" geography. They have a tendency to go their own way and not be exactly contained within other geographic areas such as counties and cities. There are also problems involved with assigning a good name to ZIP codes. The Post Office has a file with the names they want you to use for them - but these are not always the most descriptive of the actual place (city) in which the ZIP is located. This format returns various "primary" geographic codes for the ZIPs; these primary codes are the ones with which the ZIP code has the largest intersection. For example, ZIP code 63117 has for its primary county code 29189 - St. Louis county, Missouri. But about 10% of the people who live in this ZIP code actually reside in the city of St. Louis (a county equivalent with FIPS code 29510.) This format returns several primary codes and then uses a special "flag field" to let you know that the ZIP is only partially contained within that area. Although this module has a ".sas" extension, indicating a SAS source program, you can make use of this file even if you are not a SAS user. You can easily process this as a data file since it is in a fixed-field format. It can, of course, also be used as a simple text file just used for manual lookup of information with a browser. But if you are a SAS programmer you can "run" the module to create the SAS format module which you can then use in conjunction with the SAS put function to do "format table lookups" of the result codes. (You'll need a recent release of SAS for this to work: we use a 64-character label and the limit was 40 characters up until release 6.09, I believe.) For example, to assign the primary county code and the primary place code associated with a 5-character ZIP variable you could code something like the following as part of a SAS data step: .... ; length result $64; drop result; result=put(zip,$zipcods.); length fipcnty $5 placefp $5 ; fipcnty=substr(result,1,5); placefp=substr(result,46,5); We show a couple of sample lines from the source module and follow with a summary of what the "fields" are within the 64-character formatted value string. Finally, we include an excerpt from the actual SAS program code that was used to generate those formatted value strings. Sample lines from the source module (Szipcods.sas): VALUE $zipcods '01001 '='25013 Hampden MA 8000 80038003N AGAWAM ' '01002 '='25015+Hampshire MA 9999 80038003N 01290-Amherst ' '01005 '='25027 Worcester MA 9240 92431123N 03705-Barre ' ***************_________1_________2_________3_________4_________5_________6____* ssccc mmmm nnnnmm95t ppppp Name of place Summary of Result Fields ======================== Start* Len Description ----- --- ----------- 1 2 FIPS state code (part of county code, sort of) 3 3 FIPS county code -- this is the "primary" county for the ZIP. 6 1 Flag field: contains a "+" to indicate ZIP is only partly in the county whose code appears in 1-5. Otherwise blank. 7 24 Name of primary county. In mixed case, with state abbrev. May be truncated if name is too long. 31 4 Primary MSA or PMSA code, 1990. '9999' indicates not in a metro. 35 1 Flag field: "+" indicates ZIP is only partly in the primary MSA/PMSA, 1990. 36 4 New England County Metro Area code, 1990 (only in New England, will be blank for all other areas.) 40 4 1995 MSA or CMSA or NECMA code. Note use of CMSA instead of PMSA and that in New England you get NECMA code. '9999' used to indicate non-metro. This is the metro code associated with the primary county as of June 1995. 44 1 Type code for previous metro code. Values can be "M", "C" or "N". Or it will be blank if its a non-metro ZIP. 45 1 blank 46 5 1990 primary place code. We looked at all ZIP intersections with census-recognized places for 1990 and this code represents the one with the largest population intersection with the ZIP. Unincorp- orated (9999) place codes ignored. Blank here indicates ZIP did not intersect with any place. 51 1 Flag field: "+" indicates that the ZIP is at least 50% in the primary place (previous field) but is not entirely in that place. A value of "-" is similar but indicates the ZIP is less than 50% in the primary place. Blank indicates ZIP is either not in any place or is entirely within the primary place. 52 13 A name to be associated with the ZIP. If a primary place is associated with the ZIP this field contains the name of that place. Otherwise a name is assigned based on the $zipnmus format code, which is based on a file provided by the US Postal Service. * If reading this as a data file add 15 to these start values to get the starting column for the corresponding input field. SAS Source Code =============== FAQ: If I have no idea what this means, can I still use the file? ANS: Yes. But then you'll have to trust us that we did what we said. Here is a portion of the SAS program code used to create the value label string, part of the /mscdc/sasfmats/Tools/zipcodes.sas program: substr(codes,1,2)=state; substr(codes,3,3)=substr(county1,3,3); if county2 ne ' ' then substr(codes,6,1)='+'; *<---multi-county indicator; substr(codes,7,24)=put(county1,$county.); *<--co. name, incl state abbrev; substr(codes,31,4)=msapmsa1; *<--1990 MSA or PMSA code--; if msapmsa2 ne ' ' then substr(codes,35,1)='+'; *<---multi-metro indicator; if necma1 ne ' ' then substr(codes,36,4)=necma1; *<--New England only; metro95=put(county1,$comet95_.); if metro95 eq county1 then metro95='9999'; substr(codes,40,5)=metro95; ; *<--6/95 metro code and type. Will be MSA, CMSA or NECMA-; substr(codes,46,5)=placefp1; if pctpl2 gt 0 then substr(codes,51,1)='+'; if pctpl1 lt 50 and placefp1 ne ' ' then substr(codes,51,1)='-'; *<---minus sign means its less than half in the place--; if placefp1 ne ' ' then substr(codes,52,13)=put(placenm1,$fplace.); else substr(codes,52,13)=put(zip,$zipnmus.); NOTE: The source dataset used to generate the format code has more detailed information about the various geographic correspondences, such as the portion of the ZIP population in the *two* largest-intersecting counties, metro areas, places (i.e., cities), and urbanized areas. WHERE TO COMPLAIN OR COMMENT ============================ John Blodgett, (formerly with: Urban Information Center, U of Mo St. Louis) Office of Social and Economic Data Analysis (OSEDA), University of Missouri Columbia, MO blodgettj@umsystem.edu (via e-mail only, please!)