EXPORT procedure

Saves data structures to Excel, Quattro, dBase, SPlus, Gauss, MatLab, Instat and text files, PC Windows only (D.B. Baird).


Options

OUTFILE = text
Data file to be written

METHOD = string
Action to take if the file already exists (add, overwrite, prompt, fail); default prompt in interactive mode, fail in batch mode

PLAINNAMES = text
Whether to leave the column names in the file in plain form rather than decorating them with the column type information i.e. ! for factors, :D for dates etc (yes, no) default no

SHEETNAME = text
Name of new sheet to be added to an existing Excel file

NONAMES = string
Whether to suppress column names in output to spreadsheet or text file (yes, no); default no

TITLE = text
Description for spreadsheet

READONLY = string
Whether to define the complete sheet as read only (yes, no); default no

ANALYSIS = text
GenStat commands to analyse columns in the spreadsheet

ASETUP = text
GenStat commands to be run once before the analysis of any columns in the spreadsheet

ADUMMY = text
The name of the dummy (if any) used the ANALYSIS commands


Parameters

DATA = identifiers
The data structures to be written to the file, these must be compatible (i.e. of the same length)

COLUMNS = texts
Names for the columns to be saved

PROTECT = scalar
Whether the column is to be defined as read only when option READONLY=no (yes, no); default no


Description

EXPORT saves the data structures specified by the DATA parameter to a disk file specified by the OUTFILE option in a foreign data format specified by the extension of the file name. The available extensions are: .XLS for Excel, .XLSX for Excel 2007, .WQ1 for Quattro, .ODS for Open Office Spreadsheet, .DBF for dBase, .FMT for Gauss, .SDD for SPlus, .RDA for R, .TPT for SAS transport, .TAB for tab delimited text, .WOR for Instat, .MAT for MatLab, .ARFF for Weka Attribute, .TXT for plain ASCII text, .CSV for comma delimited text, .TAB for tab delimited text, .HTM for a HTML table, .RTF for Word Rich text format, .GSH for GenStat spreadsheet, .GWB for GenStat work book, and .BMP, .EMF, .GIF, .JPG, .TIF, .PNG or .PSD for an image file. An image file can be created either from single matrix containing RGB colour values, or three columns of variates or factors columns (specifying x-coordinates, y-coordinates and RGB colour values), or five columns of variates or factors columns (specifying x-coordinates, y-coordinates and red, green and blue colour values). The coordinate (0, 0) corresponds to the top left corner of the image, and the y-values increase as you move down the image.

   The SHEETNAME option allows you to specify the name of the sheet to add to an Excel file, rather than using the default 'GenStat data'. The name should only contain letters, numbers and spaces.

   The METHOD option controls how EXPORT behaves when asked to overwrite an existing file. The available settings are add, overwrite, prompt and fail, with a default of prompt in interactive mode, and fail in batch mode. The following example shows how METHOD=add can be used to build up pages in a GenStat workbook file:

TEXT OutFile; VALUE='Results.GWB'

EXPORT [OUTFILE=OutFile; METHOD=overwrite; SHEET='Maximums']\

       MaxLane,MaxLoc,WarpLoc,MaxAmp

EXPORT [OUTFILE=OutFile; METHOD=add; SHEET='Parameters']\

       ParLane,ParLoc,ParSig,ParAmp

EXPORT [OUTFILE=OutFile; METHOD=add; SHEET='Components']\

       PeakLane,PeakLoc,PeakSig,PeakAmp,PeakHt

EXPORT [OUTFILE=OutFile; METHOD=add; SHEET='Lanes']\

       eX,eLane[]

EXPORT [OUTFILE=OutFile; METHOD=add; SHEET='Warping'] eX,W[]

   The COLUMNS parameter can specify names for the columns to be saved. The setting is a text with a single line except for a matrix, where it should have a line for each column and also an extra initial line if the matrix has row labels.

   The PLAINNAMES option allows you to suppress the additional type information that GenStat adds by default to the column names (! for factors, :D for dates etc). Alternatively, you can set option NONAMES=yes to suppress the names altogether.

   The TITLE option can supply a text containing a title or description of the spreadsheet. This will be saved in a GSH or GWB file, and will be the heading of an HTML file.

   You can set option READONLY=yes to make the entire spreadsheet read-only (so that its contents cannot be changed). Alternatively, you can use the PROTECT parameter to protect any individual column (by making it read-only). Settings of the PROTECT parameter override the setting of the READONLY option.

   The ANALYSIS option can supply a text containing GenStat commands to analyse columns in the spreadsheet. The ASETUP option can similarly define commands that should be to be run once before the analysis of the columns, and the ADUMMY option can be used to define the name of the dummy (if any) used in the ANALYSIS commands.


   (Note: EXPORT replaces the procedure %DSAVE from earlier editions of GenStat.)

 

Options: OUTFILE, METHOD, PLAINNAMES, SHEETNAME, NONAMES, TITLE, READONLY, ANALYSIS, ASETUP, ADUMMY.

Parameters: DATA, COLUMNS, PROTECT.


Method

The procedure calls the FSPREADSHEET procedure to create a temporary GSH file, which is translated to the required file type using the DATALOAD.DLL library.


Action with RESTRICT

Any restrictions are ignored. However, if the restrictions on the structures are not consistent, a fault will occur.