Chapter 3. File Exchange between MineSet and SAS (IRIX only)

This chapter describes the support for file exchanges between MineSet and SAS on IRIX. The subjects discussed are:

Systems other than IRIX and Windows must use third-party solutions for file exchange.

You can exchange data sets between MineSet and SAS with two utilities: mineset2sas and sas2mineset. To convert a MineSet .schema and .data file pair to an SAS data set, use mineset2sas. To convert an SAS data set to MineSet .schema and .data files, use sas2mineset. Both mineset2sas and sas2mineset invoke the SAS executable. SAS must be installed on the machine on which these conversion utilities are used.

Converting MineSet Data Files to SAS Data Sets

Use mineset2sas to convert MineSet data files to SAS data sets. The syntax for this is:

mineset2sas MineSet file SAS libref.datafile [options]

The two options are as follows:

  • -svsc to save the script sent to SAS. The script is normally deleted after use.

  • -names namefile to save trimmed column names in namefile. The script is normally deleted after use.

For example:

mineset2sas cars sasuser.cars -svsc -names cars.names

mineset2sas converts the MineSet .schema and .data files (in this case, cars.schema and cars.data) to an SAS data file. Currently, only string and numeric data types are supported. The MineSet .data file must be in ASCII format; binary format is not supported. To save MineSet data files in ASCII, deselect Use binary data files in Tool Manager Preferences.

SAS column names (or, in SAS terminology, variable names) can consist of only letters and underscore characters. The first character in a column name cannot be a number. Furthermore, SAS column names can be up to eight characters long. Because any character string can be a legal MineSet column name, mineset2sas maps MineSet column names to legal SAS column names. The rules for this mapping are:

  • Any invalid character is replaced with an underscore.

  • If the first character is a digit, an underscore is prepended to the column name.

  • Column names are truncated to eight characters. If this truncation results in non-unique column names, the ends of the conflicting column names are replaced with sequential numbers, thus creating unique column names.

To preserve as many of the full column names as possible, mineset2sas also saves the first 40 characters of each column name as the column label.

-names namefile Command Line Option

To see a listing of the column names before and after conversion to SAS format, specify the -names namefile command line option. When mineset2sas executes, it writes out a mapping of the column name changes to the specified file. For example:

  `date of birth`-> `date_of_`
  `92census`-> `_92censu`
  `# of days to end of quarter`-> `__of_da0`
  `# of days to end of year`-> `__of_da1`
  `# of davenports`-> `__of_da2`

-svsc Option

The mineset2sas utility reads the schema for the specified data file, and writes a customized SAS script. SAS is invoked with this script to read and convert the data. The script sent to SAS is normally deleted after use. With the -svsc option, the script is saved as the file mineset2sas.sas. If there is an error in the script processing, the SAS error log is saved as mineset2sas.log. The SAS script must be installed in /usr/sbin/sas.

Converting SAS Data Sets to MineSet Data Files

Use sas2mineset to convert SAS data sets to MineSet data files. The syntax for this is:

sas2mineset <SAS libref.datafile> <MineSet file> [options]

The options are as follows:

  • -nodata creates only a .schema file, no .data file.

  • -svsc saves the scripts sent to SAS.

  • -nolabel indicates that you do not want labels used for column names.

  • -names <namefile> restores long column names from <namefile>, created by mineset2sas.

For example:

sas2mineset sasuser.houses -svsc -names houses.names

The sas2mineset utility converts a SAS data file into MineSet .schema and .data files. Currently, this utility supports only string, numeric, and date data types.

-nolabel Option

SAS only supports eight-character column names, but allows optional 40 character labels for each column. MineSet sets no limit on the column name length, so, by default, sas2mineset uses the column labels to name the columns in the output file, if labels have been defined. To force sas2mineset to use the SAS column name for each column, even if a label is specified, add the -nolabel option to the command line.

-names namefile Option

If you convert a MineSet data file to SAS with mineset2sas and then back to MineSet format with sas2mineset, you can create a column name map file to keep track of the original column names. To have sas2mineset use a name map file created by mineset2sas, add the -names <namefile> option to the command line, and specify the same map file as specified when the file was converted to SAS format with mineset2sas. This option is useful only for data files with column names longer than 40 characters, since mineset2sas saves up to 40 characters in the column label.


Note: The -name <namefile> option overrides the -nolabel option.


-nodata Option

To create only a MineSet schema file without downloading the data from an SAS data file, add the -nodata option to the command line.

-svsc Option

The sas2mineset utility writes two customized SAS scripts to retrieve the specified data file. The first script extracts column descriptions; the second extracts the data. The scripts are normally deleted after use. With the -svsc option, the scripts are saved as getschema.sas and getdata.sas, respectively. If there is an error in the script processing, the SAS error logs are saved as getschema.log and getdata.log, respectively.