Read data sets from SAS, Stata, and SPSS with ReadStat
					Maintainer(s):
					
						mettekou
					
					
				
				
				Installing and Loading
INSTALL read_stat FROM community;
LOAD read_stat;
Example
-- Read a SAS `.sas7bdat` or `.xpt` file
FROM read_stat('sas_data.sas7bdat');
FROM read_stat('sas_data.xpt');
-- Read an SPSS `.sav`, `.zsav`, or `.por` file
FROM read_stat('spss_data.sav');
FROM read_stat('compressed_spss_data.zsav');
FROM read_stat('portable_spss_data.por');
-- Read a Stata .dta file
FROM read_stat('stata_data.dta');
-- If the file extension is not `.sas7bdat`, `.xpt`, `.sav`, `.zsav`, `.por`, or `.dta`,
-- use the `read_stat` function for the right file type with the `format` parameter:
FROM read_stat('sas_data.other_extension', format = 'sas7bdat');
FROM read_stat('sas_data.other_extension', format = 'xpt');
-- SPSS `.sav` and `.zsav` can both be read through the format `'sav'`
FROM read_stat(
    'spss_data_possibly_compressed.other_extension',
    format = 'sav'
);
FROM read_stat('portable_spss_data.other_extension', format = 'por');
FROM read_stat('stata_data.other_extension', format = 'dta');
-- Override the character encoding with an `iconv`` encoding name,
-- see https://www.gnu.org/software/libiconv/
CREATE TABLE other_data AS FROM read_stat('latin1_encoded.sas7bdat', encoding = 'iso-8859-1');
About read_stat
Usage
Parameters
| Name | Description | Type | Default | 
|---|---|---|---|
| format | The format of the input file, when its extension does not indicate it, either 'sas7bdat','xpt','sav','por', or'dta' | VARCHAR | NULL | 
| encoding | The character encoding of the input file, as defined by iconv, see https://www.gnu.org/software/libiconv/ | VARCHAR | NULL | 
Added Functions
| function_name | function_type | description | comment | examples | 
|---|---|---|---|---|
| read_stat | table | NULL | NULL | 
