"Warning: Variable...already exists on file..." occurs when you use SAS/ACCESS® Interface to Microsoft SQL Server


When using SAS/ACCESS Interface to Microsoft SQL Server against tables with variable names greater than 32 characters, you can receive the following error:

WARNING: Variable long-variable-name already exists on file file-name

If you use truncated names, you can receive an error stating that the variable does not exist.

The problem occurs because Microsoft SQL Server supports table names and column names that contain up to 32 characters. SAS truncates database management system (DBMS) column names that are longer than 32 characters. If truncating a column name would result in identical names, SAS generates a unique name by replacing the last character with a number.

You encounter this problem when OPTIONS VALIDVARNAME=ANY is specified, which is the default setting in SAS® Enterprise Guide®. This problem typically does not occur in Base SAS®, which has OPTIONS VALIDVARNAME=V7 as the default setting.

To circumvent the problem, use one of the following workarounds for tables with names longer than 32 characters: