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

Hi, I have two files. One file contains LocationID and associated latitude and longitude for each LocationID. Another file is Census Tiger file (tabblock10.shp) in Shapefile format. File tabblock10 contains blockID and associated latitudes and longitudes (polygon which defines the block). I want to match these two files to determine the blockID for each LocationID (find block each location falls into based on the shape file). How to do such a spatial join in SAS? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PaalNavestad
Pyrite | Level 9

This procedure does the trick I believe

 

SAS Help Center: Syntax: PROC GINSIDE PROC GINSIDE Statement

 

You must import the shapefile using the appropriate shape importer,

 

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Please provide sample data and your desired result. Makes it much easier to provide a usable code answer.

hanfei28
Fluorite | Level 6
sample_data.csv

tl_2020_24_tabblock10.cpg

tl_2020_24_tabblock10.dbf

tl_2020_24_tabblock10.prj

tl_2020_24_tabblock10.shp

tl_2020_24_tabblock10.shp.ea.iso.xml

tl_2020_24_tabblock10.shp.iso.xml

tl_2020_24_tabblock10.shx

The desired result is to find the BlockID the set of latitude and longitude
(in the sample data) falls into.
PaalNavestad
Pyrite | Level 9

This procedure does the trick I believe

 

SAS Help Center: Syntax: PROC GINSIDE PROC GINSIDE Statement

 

You must import the shapefile using the appropriate shape importer,

 

sbxkoenk
SAS Super FREQ

Here's an example.

The GINSIDE procedure is used to find out if the location (customer) is inside or outside the polygon.

 

Example 2: Mapping and Annotating Values from the GINSIDE Procedure

https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=grmapref&docsetTarget=...

(Example 1 might be simpler.)

 

The above page has extensive info on the how and why of each individual statement in the program.

 

To import your TIGER file: go to 

https://go.documentation.sas.com/?docsetId=helpcenterwlcm&docsetTarget=home.htm&docsetVersion=1.0&lo...

and search for TIGER in the search field (click on magnifying glass).

 

Cheers,

Koen

 

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
  • 4 replies
  • 935 views
  • 0 likes
  • 4 in conversation