BookmarkSubscribeRSS Feed
Obsidian | Level 7


I'm a novice with GMAPs and I'm trying to create a Us/Canada chart with bars (values to be determined by the data) for particular cities in both US and Canada.  I'm finding the USCITY_ALL dataset in the MAPSGFK library works well for mapping to US cities.  Is there a similar map for Canadian cities?  ...Or is there another way to do it for Canada that I'm not aware of?



Super User

What version of SAS do you have?


If you're 9.3+ I think you need to be using MAPSGSFK instead?

And you can download some custom files from here :


Obsidian | Level 7


I'm using the MAPSGSFK one.  Still didn't see a table that had the Canadian cities.  Is there one?



Super User

Did you check the link? It has a sources that is available, one with city locations including 218 Canadian cities. I don't know if that would encompass your list of cities. You probably already know, but there are specific definitions for City/Town/Summer Village/Special Area etc. 


I don't know what you're trying to do, but Statistics Canada has a lot of SHP files available here:


And depending on where you work, you may have access to a file called PCCF that maps postal codes to a latitude and longitude. 


If you're looking for basic lat/long for Canadian Cities you could probably wrangle one of the StatCan files into what you need. 


And SAS provides code/process if you purchase the lookup table from


Obsidian | Level 7


The link provided seems to point me to the MAPSGFK library, and to the WORLD_CITIES table.  This works for a lot of my data but I have many cities that don't show up in the WRLD_CITIES table, not sure why:


AJAX            ON
AYR             ON
DELTA           BC
DORVAL          QC
HANWELL         NB
LEVIS          QC
LIVELY          ON

Super User

Not all of those are classified as Cities is one reason, some are towns or regional districts or components thereof. 


If you only have the few I'd probably just look them up on Google and add the coordinates in manually. 

Or, check the Open Data portals or here:



Super User
And it should be the WORLD_CITIES_ALL table, make sure it has the ALL.
Obsidian | Level 7

Ahhhh....but alas, I'm only on 9.4.3.  It looks like WORLD_CITIES_ALL is only available to SAS 9.4.5.  Bummer!


Regarding the Open Data Portals link you sent, I wouldn't even know where to begin...I just want Canadian cities with lats and longs 😞


Thanks for your help!

Super User

No, I have 9.4 M3 and found the ALL file online in the first link. 


It's long and slightly painful, but you can use PROC GEOCODE to derive them...there should be a simpler way.


This will likely give you every city, but it's a long route. 


If you only have the few missing you listed, I would probably be lazy and do it manually. The approach above is automated but longer.

Obsidian | Level 7

Ok, found it.  Was looking in the wrong link.  Just downloaded and , wouldn't you know it, the cities I need are still not there.  I guess I'll have use the proc geocode to create derive them...Lord help me.  I'm really a novice and very new at this whole 'GEO' mapping and graphing thing.


Again, thanks for all your help!!!

Super User

Most places have another look up table that simplifies this, but unfortunately it's proprietary data. 


I've assumed you're a student and have no access to other sources. Otherwise, most companies and governments have different sources 🙂

Obsidian | Level 7

No, not a student.  I work for a Volvo Trucks North America.  My access to SAS is limited to SAS EG on a CITRIX box linked to a server in Sweden.  I don't have a lot of latitude with adding or changing system libraries, files and the like. I've got some reading and learning to do.

Super User

Then ask around your company. I'm surprised they don't have a GIS unit, I'd suspect you do somewhere and they'll have the data you need. You can also purchase the data here:


This is the one recommended by SAS and is dirt cheap. 


An option we use internally here is:


There's a file that can be purchased from Statistics Canada or Canada Post and I'd be surprised if your marketing team didn't have a copy of that. 


Good Luck!

Obsidian | Level 7

Ok, will do.  Again, Thanks for your help and attention on this 🙂

Meteorite | Level 14

If the cities aren't in mapsgfk.world_cities, you might can look them up manually in Google maps, and then enter the lat/long into a dataset...


For example, go to

Search for "Levis, Canada"

Then look in the URL, and pick out the lat/long, such as "@46.710684,-71.255107", and copy-n-paste those numbers into your file/spreadsheet/wherever.


It's a bit tedious, but it's one way to get the job done.



Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 14 replies
  • 1 like
  • 3 in conversation