Remote connections fail with "ERROR: Cannot locate TCP host 'xxxxxxxx' "


You might encounter an issue in which SAS® code fails to connect to a remote host with an error similar to the following:

ERROR: Cannot locate TCP host 'xxxxxxxx'.

This error indicates that the 8-character hostname 'xxxxxxxx' does not resolve to an IP address. This is an issue on the host where the SAS code is executing.


To work around this issue, you can do either of the following:

  1. Use the Fully Qualified Domain Name (FQDN) or IP address in the SAS code. Here is an example:

 %LET rmthost=ab.cd.ef.com; 

 Then, use the macro variable specified in the %LET statement in the SAS code.

  1. Add the 8-character host name to your Domain Name System (DNS) server or your local host's Host Table.


Here are some examples of using macro variables in SAS code:

SAS/CONNECT®:

%let r=rmt.company.com 7551;
signon r user= pass=;


%let rmtmvs=10.50.9.46 7551;
options remote=rmtmvs;
signon user=  pass=  ;

SAS/SHARE®:

%let r=hp.unx.com 8551;
libname slibref=<remote libref> server=r;

For additional details and examples, refer to the Communications Access Methods Guide for SAS/CONNECT® 9.4 and SAS/SHARE® 9.4.

You can use the following utilities from a command prompt to verify whether the host name resolves to an IP address outside of SAS: nslookup and dig. You can also use utilities such as Telnet and ping from a command prompt to test whether you can reach the host name outside of SAS.

If you are already specifying an FQDN in a macro variable and receiving the above error, the FQDN might not be valid or might not be found. In this case, you need to contact your site's network administrator.