READSTAT(1) | General Commands Manual | READSTAT(1) |
readstat - read and write data set files from SAS, SPSS, and Stata
readstat input-file
readstat [-f] input-file output-file
readstat [-f] input-file metadata-file output-file
readstat converts data set files from popular statistics packages stored in both plain-text and binary formats.
In the first invocation style, readstat displays metadata from input-file, including the row count, column count, text encoding, and timestamp. input-file should be a file with one of the following extensions:
If the row count cannot be determined from the file header, which is sometimes the case with SPSS binary files and always the case with SPSS portable files, readstat will report a value of -1.
In the second invocation style, readstat converts input-file to output-file, e.g. a SAS portable file to a Stata binary file. In addition to the preceding extension list, output-file may have extension csv or xlsx, which creates a CSV or Excel file, respectively.
The third invocation style is used when additional metadata about the input file, such as value labels or column widths, is stored in a separate file. Several types of metadata file are supported:
The last three formats can be used for both fixed-width and delimiter-separated (e.g. tab-separated) input files. These are commonly distributed along with plain-text ASCII data sets.
Both input and output formats are implied by the file extension.
SAS binary files created by readstat do not open with current versions of SAS.
The finer details of format strings (e.g. "%8.2g") are not properly converted between file formats.
Copyright (C) 2012-2019 Evan Miller, and others where indicated.
23 January 2019 |