I have a data set which has sets of geographic coordinates for a list of properties. Each property has coordinates for buildings. How can I estimate the size of each property using these coordinates in SAS? I'm thinking I could go by the furthest points North, South, East, and West and use that to estimate the total area in acres (43,560 sq ft).
I figured out the issue. Elementary. To convert to acres I had to MULTIPLY the sq miles estimate by 640, not divide.
proc sql;
create table MAX_COOR as select PROP, max(lat) as NORTH, min(lat) as SOUTH, max(lon) as EAST, min(lon) as WEST
from BLDGS
group by PROP;
quit;
data dist; set MAX_COOR;
distance_length = geodist(NORTH, EAST, NORTH, WEST, 'M');
distance_width = geodist(NORTH, EAST, SOUTH, EAST, 'M');
run;
data area; set dist;
area_acres = (distance_length * distance_width)*640;
run;
This is a situation where you have a very specific question, and the best way to get a solution is via Internet search.
"calculate area of polygon from lat long"
Here is a solution, it isn't SAS, but you could easily adapt it to SAS
https://www.sisense.com/blog/polygon-area-from-latitude-and-longitude-using-sql/
Here is what I have, but the area values don't look correct. Am checking data...
proc sql;
create table MAX_COOR as select PROP, max(lat) as NORTH, min(lat) as SOUTH, max(lon) as EAST, min(lon) as WEST
from BLDGS
group by PROP;
quit;
data dist; set MAX_COOR;
distance_length = geodist(NORTH, EAST, NORTH, WEST, 'M');
distance_width = geodist(NORTH, EAST, SOUTH, EAST, 'M');
run;
data area; set dist;
area_acres = (distance_length * distance_width)/640;
run;
Share your data as SAS data step code (instructions)
I figured out the issue. Elementary. To convert to acres I had to MULTIPLY the sq miles estimate by 640, not divide.
proc sql;
create table MAX_COOR as select PROP, max(lat) as NORTH, min(lat) as SOUTH, max(lon) as EAST, min(lon) as WEST
from BLDGS
group by PROP;
quit;
data dist; set MAX_COOR;
distance_length = geodist(NORTH, EAST, NORTH, WEST, 'M');
distance_width = geodist(NORTH, EAST, SOUTH, EAST, 'M');
run;
data area; set dist;
area_acres = (distance_length * distance_width)*640;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.