Statistical File

This article describes how to connect Tableau to a statistical file and set up the data source.

Tableau connects to SAS (*.sas7bdat), SPSS (*.sav), and R (*.rdata, *.rda) data files.

Make the connection and set up the data source

  1. Start Tableau and under Connect, select Statistical File, select the file that you want to connect to, and then select Open.

  2. On the data source page, do the following:

    1. (Optional) Select the default data source name at the top of the page, and then enter a unique data source name for use in Tableau. For example, use a data source naming convention that helps other users of the data source figure out which data source to connect to.

    2. Select the sheet tab to start your analysis.

      For information about connecting to more than one table, see Join Your Data.

Statistical file data source example

Here is an example of a statistical file data source using Tableau Desktop on a Windows computer:

Note the following:

  • The Statistical File connector does not support value labels.

  • The Statistical File connector supports only one table per statistical file.

    If an error message appears, "An error occurred while communicating with the data source," make sure that your statistical file contains only one object, and that the object is a data frame or a matrix. R files may contain hidden objects in what appears to be a clean workspace. To check for hidden objects, run ls(environment(), all.names=TRUE) from RStudio.

  • You can change the character encoding for a statistical file. For more information, see Change the character encoding for statistical files.

R data file object and format support

R data files should contain only one of the following types of objects:

  • Two-dimensional matrices

  • Vectors

  • Factors

  • Data frames

Note that if the R data file contains more than one object, Tableau will connect to the first one.

Supported R file formats are binary or ASCII. Compressed files are not supported in Tableau Desktop. You must decompress files first with another program, such as Gzip or WinZip, before you connect with Tableau.

Change the character encoding for a statistical file

Tableau reads the data in a statistical file (for example, an SAS or R file) based on the file's character encoding or on information in an input file. R files typically use the character encoding of the operating system, compared to SAS and SPSS files, which include the character encoding information in the file. Sometimes, you might need to specify a different encoding. For example, if a colleague sends you a statistical file with Greek character encoding, then you must specify a Greek character set to use the file with Tableau. If you need to use a different character set when reading from a statistical file, you can create a Tableau data source customization (TDC) file and specify the encoding to use.

Create the TDC file

A .tdc file is an XML file that applies to a single data source and contains vendor and driver name information of the data source provider. For the statistical file connector, the vendor and driver name is stat-direct.

To create a TDC file:

  1. Open a plain text editor, such as Notepad.

  2. Copy the information from the sample provided below, paste it into your text file, and then specify the source-charset value. (For a list of encodings, see User-defined Encodings Supported by the Statistical File Connector.)

  3. Save the file with a .tdc extension—for example, r-statsfile.tdc—to the My Tableau Repository\Datasources folder.

Sample TDC file sets the source-charset value

The following TDC file example sets the source-charset value to shift-jis for a statistical file data source.

                <connection-customization class='stat-direct' enabled='true' version='10.0'>
<vendor name='stat-direct' />
<driver name='stat-direct' />
  <customizations>
    <customization name='source-charset' value='shift-jis' />
  </customizations>
</connection-customization>
            

Important: Tableau does not test or support TDC files. These files should be used as a tool to explore or occasionally address issues with your data connection. Creating and maintaining TDC files requires careful manual editing, and there is no support for sharing these files.

About .ttde and .hhyper files

You might notice .ttde or .hhyper files when navigating your computer's directory. When you create a Tableau data source that connects to your data, Tableau creates a .ttde or .hhyper file. This file, also known as a shadow extract, is used to help improve the speed your data source loads in Tableau Desktop. Although a shadow extract contains underlying data and other information similar to the standard Tableau extract, a shadow extract is saved in a different format and can't be used to recover your data.

In certain situations, you might need to delete a shadow extract from your computer. For more information, see Low Disk Space because of TTDE Files in the Tableau Knowledge Base.

 

See also

Thanks for your feedback! There was an error submitting your feedback. Try again or send us a message.