Normally when you use put(var, format), it will either return the corresponding label or the original value if there is no match in the format. However, returning the original value defeats the purpose of using user-defined formats in many cases. Does anybody know if there's a "clean" or "built-in" way to force the put statement (or some other function) to return a blank or null instead of the original value when the format has no match? For example, if we're using a zip to city format called $zip_city: data test; input zip $5.; datalines; 43765 ; run; data test2; set test; city = put(zip, $zip_city.); run; The above code returns city = 43765 (since that zip does not exist in the US yet), but I'd like a blank or null returned. I can always force a blank return with an if statement (if put(zip, $zip_city.)=zip then city=.), but if anybody can enlighten me with a better way I'd really appreciate it! SAS 9.4 Thank you!
... View more