11-07-2017 11:22 AM
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?
11-07-2017 12:31 PM
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
11-07-2017 03:48 PM
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 zipcodedownloads.com
11-10-2017 11:28 AM
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:
11-10-2017 11:47 AM
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:
11-10-2017 11:54 AM
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!
11-10-2017 12:14 PM
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.
11-10-2017 12:38 PM
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!!!
11-10-2017 12:45 PM
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
11-10-2017 12:48 PM
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.
11-10-2017 12:54 PM
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.
4 weeks ago
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.