1READSTAT(1) General Commands Manual READSTAT(1)
2
3
4
6 readstat - read and write data set files from SAS, SPSS, and Stata
7
9 readstat input-file
10
11 readstat [-f] input-file output-file
12
13 readstat [-f] input-file metadata-file output-file
14
16 readstat converts data set files from popular statistics packages
17 stored in both plain-text and binary formats.
18
19 In the first invocation style, readstat displays metadata from in‐
20 put-file, including the row count, column count, text encoding, and
21 timestamp. input-file should be a file with one of the following ex‐
22 tensions:
23
24 sas7bdat
25 SAS binary file, created with SAS version 7 or newer
26
27 xpt SAS portable file, version 5 or version 8, created with the SAS
28 XPORT command
29
30 sav SPSS uncompressed binary file
31
32 zsav SPSS compressed binary file
33
34 por SPSS portable file
35
36 dta Stata binary file, version 104 or newer
37
38 If the row count cannot be determined from the file header, which is
39 sometimes the case with SPSS binary files and always the case with SPSS
40 portable files, readstat will report a value of -1.
41
42 In the second invocation style, readstat converts input-file to output-
43 file, e.g. a SAS portable file to a Stata binary file. In addition to
44 the preceding extension list, output-file may have extension csv or
45 xlsx, which creates a CSV or Excel file, respectively.
46
47 The third invocation style is used when additional metadata about the
48 input file, such as value labels or column widths, is stored in a sepa‐
49 rate file. Several types of metadata file are supported:
50
51 sas7bcat
52 SAS binary "catalog" file, created with SAS version 7 or newer,
53 containing value labels
54
55 json JavaScript Object Notation (JSON) file, containing column meta‐
56 data that cannot be gleaned from the input CSV. For details, see
57 the manual page for the extract_metadata command.
58
59 dct Stata dictionary file, containing the data layout and column
60 metadata for a plain-text input file.
61
62 sps SPSS command file, describing the data layout and column meta‐
63 data for a plain-text input file.
64
65 sps SAS command file, describing the data layout and column metadata
66 for a plain-text input file.
67
68 The last three formats can be used for both fixed-width and delimiter-
69 separated (e.g. tab-separated) input files. These are commonly distrib‐
70 uted along with plain-text ASCII data sets.
71
72 Both input and output formats are implied by the file extension.
73
75 -f Overwrite any existing output-file.
76
78 SAS binary files created by readstat do not open with current versions
79 of SAS.
80
81 The finer details of format strings (e.g. "%8.2g") are not properly
82 converted between file formats.
83
85 Copyright (C) 2012-2019 Evan Miller, and others where indicated.
86
87
88
89 23 January 2019 READSTAT(1)