*! version 0.0.1 28may2015

Title

svm -- SVM^Light data format

Syntax

export_svmlight varlist using

import_svmlight using [, clip]

using The filename of the svmlight dataset.

Description

svmlight is a SVM software which created a simple de-facto plaintext standard for medium-sized numeric datasets, which was adopted by svmlight.
The kind libsvm authors even provide a repository of datasets in compressed svmlight format
(note: this module does not handle compression; you will need to use an external program for that).

export_svmlight saves the current Stata dataset to disk in svmlight format. The first variable is used as the outcome variable, which gets written without an attached column index.

import_svmlight loads the a dataset svmlight format into Stata (clearing the current dataset). The outcome variable will become the first column.
clip tells the importer to silently drop trailing columns if there are more than matsize allows.

The svmlight format is designed to hold a single outcome variable and a sparse set of predictor variables.
Exporting and reimporting a dataset through svmlight will lose your data labels, description, and all other metadata.
Missing data in your dataset will be skipped during export, and missing "features" will become missing data when imported.

Examples: Loading a dataset

. !wget http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/duke.bz2

. !bunzip2 duke.bz2 -c > duke.svmlight

. import_svmlight using "duke.svmlight"

. list

Examples: Saving a dataset

. webuse highschool

. export_svmlight * using "highschool.svmlight"

. type "highschool.svmlight"