Import and Export data

Import into an Edit Table or List from a text file

To import a definition from a text file into an edit table or list:

1. Select the definition field of the variable in either the Object window or Attribute panel definition view. If variable is a table, open the edit table.
2. If you are importing a simple tab-delimited file, then select the cell(s) in which to import. If you are importing a data file in the format described in Model file formats, then the cell selection is not used.
3. Select Import from the File menu. A dialog prompts you for the file name from which to import.

To import all the elements of a multidimensional table (including all the slices), a special text format is required (see Model file formats). This is also the format in which an edit table or result table is exported. The indexes of the table must have been previously created as nodes.

Export a result table to a text file

To export a variable’s result table to a text file, first be certain that the text file is closed.

1. Select the variable to be exported from and open its Result window.
2. Select Export from the File menu. A dialog prompts you for the file name to export to.

Printing to a File

Another way of exporting any Diagram window, Object window, or Result window to a file is to print to a file:

1. Select Print from the File menu.
2. Select Print to File and press Enter or click OK.
3. Enter the name of the file and the format for the file in the dialog that appears.

Edit Table Data Import/Export Format

Multidimensional data being imported or copied into an edit table must be in a text file with the special format described in this section. This is also the format in which an edit table or result table is exported.

• TextTable is a keyword.
• View is the name of the view from which the data originated. If your data was exported from an edit table, this is EditTable. If it was exported from a result table, it will be Value, Mean, Statistics, Probbands, PDF, CDF or Sample.
• Variable identifier is the identifier of the variable node where the data originated.
• Index identifier is the identifier of the index for this variable. An index with this name must already exist in the model, with the same length as in the file. When the index is a domain index, the <Index Identifier> is of the form Domain of <identifier>.
• Each index value and array value pair must be separated by tab characters.
• Numeric values appear directly, in any of Analytica’s standard number or date/time formats.
• Text values are enclosed in either double (") or single (') quotes. Tab and newline characters cannot appear between the quotes. If the text between the quotes includes a tab or newline character, it must be escaped using one of the sequences: \n, \r, \t. If a backslash or quote character appears in the text, it too must be escaped using \\, \'or\". (When the text is enclosed in double quotes, single quotes don’t have to be escaped, and vice versa).
• Expressions (from edit table cells), which include distribution functions that might appear in edit table cells, appear without quotes as long as they single-line expressions (i.e., do not contain any newline characters), do not start and end with the same quote character (such as the expression "a" & "b"), and do not contain any tab character. Otherwise, the entire expression is enclosed between tildes, and the escape sequences \n, \r, \t, \\, \~ are used for newline, tab, backslash or tilde characters. For example, the following multi-line expression:
var s:= "~~”;
JoinText(A, I, s) & '\'
would appear as ~var s:= "\~\~”;\rJoinText(A, I, s) & '\\'~.
• The value null may appear as Null.

One-dimensional array

The format for a one-dimensional array is:

TextTable <View> <Variable identifier> <line break>
<Index identifier><line break>
<Index value><tab><Array value><line break>


Example

Two-dimensional array

The format for a two-dimensional array is:

TextTable <View><Variable identifier><line break>
<Index1 identifier><tab><Index1 values separated by tabs>
<line break>
<Index2 identifier><line break>
<Index2 value1><tab><Array values separated by tabs><line break>
<Index2 value2><tab><Array values separated by tabs><line break>
<Index2 valueN><tab><Array values separated by tabs><line break>


Example

Three-dimensional array

The format for a three-dimensional array is:

TextTable <View> <Variable identifier> <line break>
<Index1 identifier><tab><Index1 Value1><line break>
<Index2 identifier><tab><Index2 values separated by tabs><line break>
<Index3 identifier><line break>
<Index3 value1><tab><Array values separated by tabs><line break>
<Index3 value2><tab><Array values separated by tabs><line break>
<Index3 valueN><tab><Array values separated by tabs><line break>
<Index1 identifier><tab><Index1 Value2><line break>
<Index2 identifier><tab><Index2 values separated by tabs><line break>
<Index3 identifier><line break>
<Index3 value1><tab><Array values separated by tabs><line break>
<Index3 value2><tab><Array values separated by tabs><line break>
<Index3 valueN><tab><Array values separated by tabs><line break>


And so on for each value of Index1.

Example

Number format

Numerical data can be imported in any format recognized by Analytica (see Number formats).

Numerical data is exported in the format set for the table, with these exceptions:

• Suffix format numbers are exported in scientific exponential format.
• Fixed decimal point numbers of more than 9 digits are exported in scientific exponential format.
• If a date format begins with the day of the week, e.g., “Saturday, January 1, 2000”, the weekday is suppressed: “January 1, 2000”.