BookmarkSubscribeRSS Feed
ndovie
Calcite | Level 5

Hello, in the SAS Street Geocoding guide, it suggests removing extraneous information to improve street geocoding. I would like to remove the apartment or lot number at the end of the address string e.g., “1122 Main St Apt xxx” or “1122 Main St Lot xxx”, resulting in "1122 Main St"  to clean these data in preparation for street geocoding. I’m having difficulty with SAS code (below) to do this. Please advise? Thx!

 

data Test ; set Data1 (keep=address city zipcode state) ;
SUB = '<Apt>';
address = transtrn(STR,SUB,trimn(''));
run;

1 REPLY 1
SASKiwi
PROC Star
data want;
  street = "1122 Main St Apt xxx";
  street_cleaned = substr(street, 1, findw(upcase(street),'APT')-1);
  put _all_;
  street = "1122 Main St Lot xxx";
  street_cleaned = substr(street, 1, findw(upcase(street),'LOT')-1);
  put _all_;
run;

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
  • 1 reply
  • 209 views
  • 0 likes
  • 2 in conversation