BookmarkSubscribeRSS Feed
Calcite | Level 5


I downloaded census data files with zip code coordinates. the files are tl_2013_us_zcta510.dbf, tl_2013_us_zcta510.shx, and tl_2013_us_zcta510.shp from the census data site. the census site location is

I am trying to create a gmap by zip code. I can do it just fine by county and state, but not by city or zip code. When I try and do it by zip code using the census data the black border lines are filling in much of the map making it useless. What gives? Below are the basics of my process, I tried attaching a screenshot of the map but the forum won't let me.

Thanks, I appreciate all help and comments.

/* importing the census data for zip code coordinates*/

proc mapimport datafile="/folder/proj/&dir/&user/Notes/&prj/Data/tl_2013_us_zcta510.shp"



/*importing a file containing a list of all florida zip codes */

      Data FL_Zips;

  infile "/folder/proj/&dir/&user/Notes/&prj/Data/FL_Zips.csv"

          dlm=',' dsd firstobs=3;

      input    Zipcode  :  $5.;

    format zipcode $5.    ;


/* filter so the map data set only contains florida zips */

proc sql; create table zipdata2 as

select distinct t1.ZCTA5CE10 as Census_Zip,



from zipdata t1 left join FL_Zips t2 on (t1.ZCTA5CE10=t2.Zipcode)

where t2.zipcode is not missing

order by Census_Zip;quit;

/* attempting to create the map that outlines the zip codes in Florida. This creates a map where the border of Florida is accurate, but the interior of the map is mostly the black border  filling in all over the place */

proc gmap=zipdata2 map=zipdata2;


choro census_zip;



Calcite | Level 5

Hi, I am facing the same problem too. wondering if you found any solution to fix this.  Trying to gmap by zipcode and all I see is the borders criss-crossing and black lines all over the map. Please let me know if you found any solution to this. I was trying to map some zipcodes of locations on a  county map.  Thanks

SAS Employee

The Census data is not sorted by the ZCTA variable (zip code).  You must use the ID statement with the ZCTA data set on Proc MAPIMPORT.

proc mapimport datafile="/folder/proj/&dir/&user/Notes/&prj/Data/tl_2013_us_zcta510.shp"


        id zcta5ce10;   


SAS/GRAPH(R) 9.4: Reference, Third Edition

Calcite | Level 5

Thank you so much Darrell. Id statement did fix the problem. One more question though, I actually have street addresses to map, I work on SAS enterprise guide and do not have access to sas/gis tool. Is there any other way to geocode the exact street addresses without the sas/gis tool? I am new to this, and just learning about gmap and geocoding. Thanks a lot for your Tips and tricks papers.

SAS Employee

Yes.  In SAS/Graph, there is Proc GEOCODE.  It will geocode street addresses.  Plus geocode a lot of other ways.

Look at our paper: PROC GEOCODE: Finding Locations Outside the U.S. 

There is a paper and examples.

You might look through the other papers in  There are a number of Mapping papers in there that might be useful.  Most have zipfiles with examples which can be useful.

Super User

Note also that not geographic areas are assigned a ZIP code in that data.

Quartz | Level 8

When selecting the Florida zip-codes you order by Census_zip.

This may disrupt the order of the individual X-Y-observations within each value for Census_zip, which would lead to criss-crossing lines.

I am not sure that is the case here, but it is safer to add a sequence-value to the observations first (in a data step: seqNum=_N_); and use that to order by as well.

SAS Employee

To Harvey_D, you can sort by just Florida by looking at the ZCTA code rather than having a list of "ZIP Codes".  Florida is 32xxx to 34xxxx.  So you can sort your ZIPDATA data set by looking at the first two characters of the ZCTA.  ZCTA codes are not exactly ZIP Codes.

List of ZIP code prefixes - Wikipedia, the free encyclopedia



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 5 in conversation