Exporting to a SAS Transport File

If your dataset does not include variables with more than 8 characters you can export to a SAS Transport file which is compatible with earlier versions of SAS (v6 and higher).

Export to SAS Transport file

  1. Go to File|Export Interviews.
  2. Select SAS Transport File (.XPT) from the Save as type drop-down box.
  3. Select Variable Subset if desired.
  4. Click Options and make any desired changes.
  5. Click Save.

Export SAS Transport file dialog box

A dialog box will tell you how many interviews were exported to the specified SAS transport file. If your data contains any variable names longer than 8 characters, you will receive an error (longer variable names must be exported to SAS XML format).

SAS Save As Options

SAS Transport file options

After clicking the Options button from the Save As box, the SAS Options box will open. The following label, Special Value, and missing data options may be set on the SAS Options window:

  • Include Question Number with Variable Label: Check to include the question number with variable label. The question number will be added at the beginning of the label. (default setting is not checked)
  • Special Value Recodes: To change how QDS Special Values are exported, select an option from the Special Value Recodes, Recode to box.
    • Special Codes: Convert to Special Codes, as defined in the Design Studio. Special Responses include Don't Know (default = 9 … 7), Refused (default = 9 … 8), Not Applicable (default = 9 … 9), and Skipped (default = 9 … 9). (default setting)
    • Missing (.): Convert to SAS System Missing.
    • Range Bottom: Convert to the minimum allowable value for the corresponding variable, as defined in the Design Studio.
    • Range Top: Convert to the maximum allowable value for the corresponding variable, as defined in the Design Studio.
    • Range Middle: Convert to the midpoint of the allowable range for the corresponding variable, as defined in the Design Studio.
    • Changing Special Code Values: Convert to the values specified in the boxes to the right. The default specified values for SAS will be enabled when the Specified Values radio button is selected. These suggested values in the boxes may be modified.

After you have finished updating and reviewing your options, click OK.

Click the Save button to (re-)create your file for export. Data for all Standard Version interviews will be copied to the file. Variable names and labels will be included.

Changing Special Code Values

To change how QDS special values are exported, select the Specified Values option from the Special Value Recodes box. Default values are listed in the boxes to the right; however, they can be changed to any other integer.

SAS Special Value Recodes box

Export Limits

QDS supports a SAS format that imposes the following maximum lengths:

  • Variable names: 8 characters
  • Variable labels: 40 characters (Chinese, Japanese, and Korean: 20 characters)
  • Value labels: 255 characters (Chinese, Japanese, and Korean: 127 characters)
  • Text responses: 200 characters (Chinese, Japanese, and Korean: 100 characters)

Convert SAS Transport files to SAS data files

Since the exported data is a transport file, you will need to convert it to a SAS dataset.

To load data from the Transport File into SAS:

  1. Execute the .XPT transport file by double-clicking on the XPT file in Windows Explorer.
  2. SAS will start and read in the transport file.
  3. Run the appropriate code to write out the data set to your SAS Library.

The following example code uses the SAS Export engine to copy the SAS transport file (Survey.XPT) to a Version 8 SAS data set (Survey):

/* Convert from Transport File to SAS data file */

libname trans xport 'c:\QDS\my data\Survey.xpt';

libname demolib v8 'c:\QDS\my data';

proc copy in=trans out=demolib;

run;

Tip: If the name specified in the File Name box for the SAS Transport (.XPT) file is longer than 8 characters, the generated data set name is truncated to 8 characters. For example, the SAS Transport file “Transport.XPT” will create the SAS dataset “Transpor.sas7bdat". In general, it is simpler to limit SAS dataset names to 8 characters or fewer.