Finding the FOREIGNers in your SAS environment

As Shane reveals on his blog, your SAS session is equipped to read data that are encoded for all types of machine architectures and locales. ASCII, EBCDIC, 32- or 64-bit, English, Japanese, Greek, Hebrew: the list goes on and on. SAS accomplishes this by using a feature called Cross-Environment Data Access (CEDA). You don't have to do anything special to enable this, but you know it's working when you see a note like this in your SAS log:
NOTE: Data file TEST.HMEQ.DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance.
First, some background about data set encoding and how it works within SAS.

All SAS data set files have an encoding that controls how the data are laid out and accessed within the file structure. The encoding varies based on platform architecture (32 vs. 64 bits, for example, or ASCII vs. EBCDIC) and locale-based data representation (latin1 for Western languages, shift-jis for Japanese as examples).

Your SAS session also has an encoding value which determines the default representation that data sets are expected to use. This is controlled in part by the -ENCODING system option and in part by the CPU architecture (32- or 64-bit) of your SAS version.

SAS data files that match your session encoding are considered NATIVE, while data files that are encoded differently are considered FOREIGN. CEDA kicks in when you access a FOREIGN encoding. Because CEDA has some limitations, you might want to consider modifying data sources that you use often into a native encoding.

If you want to see which data sources in a SAS library are considered "foreign", you can run this program. (The library in this example is named TEST.)

%let Library = TEST ;
proc sql;
title "Encoding of Data Sets in &Library";
select memname, datarep, datarepname, encoding
from sashelp.vtable where
libname="&Library"
and memtype = 'DATA';
quit;
title;

Here is an example of the output running on SAS for Windows (32-bit):

Here is the output for the same data when run on a 64-bit version of SAS:

Notice how the 32-bit data representations are now recognized as "foreign" on the 64-bit session? You can still use the data for analysis and reporting, but it will run through CEDA.