Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Survey Data / Documentation / Using SAS XPORT Files

Using SAS XPORT Files

SAS Institute (Cary, NC) has developed software (an XPORT engine) that allows data sets to be moved across platforms. Data stored in XPORT format can be analyzed in SAS on any platform for which SAS is available. In other words, if data are stored in SAS XPORT format on a mainframe, then the data can simply  be transferred (via FTP) to a PC that is equipped with PC-SAS to analyze the data. It is the file format used for all CHNS data, and it is stored on the host machine in a single format, without regard to the environment that users operate.

Many other applications, such as SPSS, can read SAS XPORT Files. Consult the documentation for your particular software for details. For those whose software cannot read SAS XPORT Files directly, a conversion software program, such as dbms/copy, can convert SAS XPORT Files to a wide variety of file formats.

For SAS users who are unfamiliar with SAS XPORT Files, locate SAS documentation for SAS XPORT Files. As always, the best sources for such information are the users’ manuals; try the SAS Language Reference. For those without access to manuals, some sample code is included below. Incorporate the following into your code to turn a SAS XPORT File into a file in native engine format.

An important feature of the XPORT engine is the concept of members. Just like a SAS data set is a member of a SAS library (often a sub-directory), XPORT data sets have members. Although an XPORT File usually has only one member, it is important not to forget the member name of the data set.

When declaring an XPORT library reference, the libname statement actually points to a file that  contains a single member: the XPORT data set. It is necessary to know the member name of the data set, since it may differ from the name of the file that is referenced in the library reference. In the examples below, all member names are alpha, but in the data you transfer (via FTP) from the CHNS, the member name is the same as the file name. Even though the name is the same, it must still be repeated in the data step portion of your program.

Unix Example

/**Notice that the entire filename is specified in the libname statement**/
/**Unlike a normal filename in which only the path is specified        **/
libname in xport '/your/file/system/data/c89hh1.0896.xpt';
data one;
   set in.alpha;
run;

Windows Example

libname in xport 'c:\webdata\chns\c89hh1.0896.xpt';
data one;
   set in.alpha;
run;

MVS Example

//*JCL STATEMENTS
// EXEC SAS
//IN DD DSN=C89HH1.0896.XPT,DISP=OLD
LIBNAME IN XPORT;
DATA ONE;
   SET IN.ALPHA;
RUN;