Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAS_READ Unsupported character set code: 204 encoding set to 'any' #482

Closed
sclewis23 opened this issue Nov 2, 2019 · 1 comment
Closed
Labels
feature a feature request or enhancement readstat

Comments

@sclewis23
Copy link

I'm facing issues reading SAS files when the encoding is set to 'any'.
Error is Unsupported character set code: 204.
See reprex including simple SAS code to create sample file.

#SAS CODE:
# Data Weight2; 
# input IDnumber $ week1 week16; 
# AverageLoss=week1-week16; 
# datalines; 
# 2477 195 163
# 2431 220 198
# 2456 173 155
# 2412 135 116
# ;
# libname outlib '~' outencoding='UTF-8';
# data outlib.Weight_utf8;
# Set Weight2;
# Run;
# libname out_any '~' outencoding='any';
# data out_any.Weight2;
# Set Weight2;
# Run;
library(haven);
read_sas("~/weight2.sas7bdat");
#> Unsupported character set code: 204
#> Error in df_parse_sas_file(spec_data, spec_cat, encoding = encoding, catalog_encoding = catalog_encoding, : Failed to parse /home/[email protected]/weight2.sas7bdat: File has an unsupported character set.
read_sas("~/weight_utf8.sas7bdat")
#> # A tibble: 4 x 4
#>   IDnumber week1 week16 AverageLoss
#>   <chr>    <dbl>  <dbl>       <dbl>
#> 1 2477       195    163          32
#> 2 2431       220    198          22
#> 3 2456       173    155          18
#> 4 2412       135    116          19

Created on 2019-11-01 by the reprex package (v0.3.0)

@hadley hadley added feature a feature request or enhancement readstat labels Nov 6, 2019
evanmiller added a commit to WizardMac/ReadStat that referenced this issue Mar 19, 2020
@sclewis23
Copy link
Author

@hadley - It looks like WizardMac/ReadStat has added support for "any" encoding....How often do you incorporate changes from ReadStat ?

@hadley hadley closed this as completed in 74f73aa Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement readstat
Projects
None yet
Development

No branches or pull requests

2 participants