BookmarkSubscribeRSS Feed
bendsteel6
Obsidian | Level 7

Hi,

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?

 

Thanks!

14 REPLIES 14
Reeza
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 : http://support.sas.com/rnd/datavisualization/mapsonline/html/home.html

 

bendsteel6
Obsidian | Level 7

Hi,

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

 

Thanks.

Reeza
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:

http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm

 

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 zipcodedownloads.com

 

bendsteel6
Obsidian | Level 7

Hi,

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
DARTMOUTH       NS
DELTA           BC
DORVAL          QC
ETOBICOKE       ON
HANWELL         NB
LEVIS          QC
LIVELY          ON
MAIDSTONE       ON
MISSISSAUGA     ON
PEACERIVER      AB
SAINT-HYACINTHE QC
SAINT-PRIME     QC
SAINT-REMI      QC
SOUTHGLENGARRY  ON
STONEYCREEK     ON

Reeza
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:

http://www.nrcan.gc.ca/earth-sciences/geography/topographic-information/free-data-geogratis/download...

 

 

Reeza
Super User
And it should be the WORLD_CITIES_ALL table, make sure it has the ALL.
bendsteel6
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!

Reeza
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.

http://support.sas.com/resources/papers/proceedings10/332-2010.pdf

 

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.

bendsteel6
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!!!

Reeza
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 🙂

bendsteel6
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.

Reeza
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:

 

https://zipcodedownload.com/

 

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

 

An option we use internally here is:

https://www.dmtispatial.com/

 

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!

bendsteel6
Obsidian | Level 7

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

GraphGuy
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 maps.google.com

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.

 

sas-innovate-2024.png

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
  • 2145 views
  • 1 like
  • 3 in conversation