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

Does zipcitydistance(zip1, zip2)    calculate only 5 digit zip code ?

I need to calculate the distance between two 9 digit zipcodes.

 

when I ran the 9 digits zipcode to calculate the distance, the log shows error "

NOTE: Invalid argument to function ZIPCITYDISTANCE('006460000','010133140') at line 28 column 13."

data _null_;

distance=zipcitydistance('006460000', '010133140');

put   ' distance 8. ' miles';

run;

 

Can someone share how to calculate the distance between 9 digit zip codes?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

The function zipcitydistance uses sashelp.zip (as documented) and that dataset contains only the five digit zip codes. So you need another function and data-source to calculate distances. Proc geocode could be used here, you want to read the documentation.

View solution in original post

1 REPLY 1
andreas_lds
Jade | Level 19

The function zipcitydistance uses sashelp.zip (as documented) and that dataset contains only the five digit zip codes. So you need another function and data-source to calculate distances. Proc geocode could be used here, you want to read the documentation.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1097 views
  • 0 likes
  • 2 in conversation