BookmarkSubscribeRSS Feed
randomusername1
Calcite | Level 5

Hello,

I am trying to plot data from the OpenFlights database on world/country/region maps in SAS University Edition.  My goal is to evaluate how accessible certain countries are by looking at the number of airports in a country and the numbers of destinations per airport.  Ideally, I would like to be able to create a map with an airport selected and draw paths to each destination airport.

 

My dataset contains a unique row for each origin airport and destination airport combination.  In total, there are 36,787 rows of data.  My variables consist of Latitude, Longitude, City, Country, Region, Destination_Count, Dest_CountryCount, Dest_RegionCount, AirportName, IATA_Code, OriginIATA_DestIATA.

 

I have tried the following options:

 

1.) Downloaded shapefiles from the link here: https://blogs.sas.com/content/graphicallyspeaking/2019/12/03/free-maps-to-use-with-sgmap-in-base-sas...

 

Using the code below, I tried to load one of the files into SAS:

 

    %let mapfile='/folders/myfolders/naturalearthvector/50m_cultural';
    %let mapfile='&mapfile.ne_50m_admin_0_countries.shp';

    proc mapimport out=world datafile="&mapfile";
    run;

 

However, my computer had issues running the code and it kept at it for 30 minutes and didn't finish, so I stopped the code.

 

2.) Use PROC SGMAP

 

    proc sgmap plotdata=AirportData;
    esrimap url='http://services.arcgisonline.com/arcgis/rest/services/
    World_Street_Map';
    bubble x=Latitude y=Longitude size=Destination_Count;
    run;

 

This was able to produce a world map but no data plotted on the map.  I received the following warning:

    WARNING: No map features have valid location information. Please check the Geography type.
 
I have latitude and longitude so I'm not sure what the issue is - is SAS unable to interpret lat and lon as map features?
 
Can someone please help with either of the two solutions I have attempted or even suggest another route I could take (pun intended).  Any help would be appreciated.
 
 
 
 

 

 

 

 

2 REPLIES 2
Reeza
Super User

Did you run the examples from the blog to ensure they work as expected for you first? If so, did those work? Did you compare the data structure of the data in the example to yours?

 


@randomusername1 wrote:

Hello,

I am trying to plot data from the OpenFlights database on world/country/region maps in SAS University Edition.  My goal is to evaluate how accessible certain countries are by looking at the number of airports in a country and the numbers of destinations per airport.  Ideally, I would like to be able to create a map with an airport selected and draw paths to each destination airport.

 

My dataset contains a unique row for each origin airport and destination airport combination.  In total, there are 36,787 rows of data.  My variables consist of Latitude, Longitude, City, Country, Region, Destination_Count, Dest_CountryCount, Dest_RegionCount, AirportName, IATA_Code, OriginIATA_DestIATA.

 

I have tried the following options:

 

1.) Downloaded shapefiles from the link here: https://blogs.sas.com/content/graphicallyspeaking/2019/12/03/free-maps-to-use-with-sgmap-in-base-sas...

 

Using the code below, I tried to load one of the files into SAS:

 

    %let mapfile='/folders/myfolders/naturalearthvector/50m_cultural';
    %let mapfile='&mapfile.ne_50m_admin_0_countries.shp';

    proc mapimport out=world datafile="&mapfile";
    run;

 

However, my computer had issues running the code and it kept at it for 30 minutes and didn't finish, so I stopped the code.

 

2.) Use PROC SGMAP

 

    proc sgmap plotdata=AirportData;
    esrimap url='http://services.arcgisonline.com/arcgis/rest/services/
    World_Street_Map';
    bubble x=Latitude y=Longitude size=Destination_Count;
    run;

 

This was able to produce a world map but no data plotted on the map.  I received the following warning:

    WARNING: No map features have valid location information. Please check the Geography type.
 
I have latitude and longitude so I'm not sure what the issue is - is SAS unable to interpret lat and lon as map features?
 
Can someone please help with either of the two solutions I have attempted or even suggest another route I could take (pun intended).  Any help would be appreciated.
 
 
 
 

 

 

 

 


 

ChrisNZ
Tourmaline | Level 20

Your code is wrong: macro variables are text strings. No quotes needed or wanted.

Since you seem to be a beginner, stick to the original example as much as possible as @Reeza said, and change things slowly.

%let mapfile='/folders/myfolders/naturalearthvector/50m_cultural';
%let mapfile='&mapfile.ne_50m_admin_0_countries.shp';

proc mapimport out=world datafile="&mapfile";
run;

should be something like

%let maploc=/folders/myfolders/naturalearthvector/50m_cultural;
%let mapfile=&maploc/ne_50m_admin_0_countries.shp;

proc mapimport out=world datafile="&mapfile";
run;

Do not use macros. Just don't. At least until the non-macro code is working as desired.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 767 views
  • 0 likes
  • 3 in conversation