If you are getting errors from the ZIPCITYDISTANCE function it means that either one, or both, Zip codes is missing or invalid.
For this function Zip+4 codes are "invalid" because the Sashelp.zipcode data set does not have centroids for the +4 versions.
This is clear with this example:
225 data example;
226 x1= zipcitydistance('83701','83704');
227 x2= zipcitydistance('83701','83704-1069');
228 run;
NOTE: Invalid argument to function ZIPCITYDISTANCE('83701','83704-1069') at line 227 column 8.
x1=1.3 x2=. _ERROR_=1 _N_=1
If you have real data like I get then Zip codes can have too many digits, missing digits, typos reversing digits which often are invalid but not always, or characters other than digits.
If your errors do not include ZIPCITYDISTANCE then you need to provide the entire log from your code. Copy the text from the log, open a text box on the forum using the </> icon that appears above the message window and paste in the box. It should look like my example above.
Do note that the documentation for the function states:
The ZIPCITYDISTANCE function returns the geodetic distance in miles between two ZIP code locations. The centroid of each ZIP code is used in the calculation.
using this definition for Geodetic:
the shortest line that can be drawn between two points on the elipsoidal surface of the earth; a curve drawn on any given surface so that the osculating plane of the curve at every point shall contain the normal to the surface; the minimum line that can be drawn on any surface between any two points.
... View more