BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RandoDando
Pyrite | Level 9

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

1 ACCEPTED SOLUTION

Accepted Solutions
RandoDando
Pyrite | Level 9

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;

View solution in original post

5 REPLIES 5
RandoDando
Pyrite | Level 9
As for precision, my data has Lat and Long at 6 decimal places.
PaigeMiller
Diamond | Level 26

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/

--
Paige Miller
RandoDando
Pyrite | Level 9

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;
PaigeMiller
Diamond | Level 26

Share your data as SAS data step code (instructions)

--
Paige Miller
RandoDando
Pyrite | Level 9

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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1009 views
  • 2 likes
  • 2 in conversation