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

Issue with some labels not applied when reading SAS #529

Closed
jacciz opened this issue Jun 5, 2020 · 1 comment · Fixed by #713
Closed

Issue with some labels not applied when reading SAS #529

jacciz opened this issue Jun 5, 2020 · 1 comment · Fixed by #713
Labels
bug an unexpected problem or unintended behavior readstat

Comments

@jacciz
Copy link

jacciz commented Jun 5, 2020

I'm reading a SAS database into R using our format file. I see the labels are applied to only some of the columns. In SAS, I see the format is applied to each column, just fine, so I'm not sure why the catalog file is not working when reading into R.

I put a sample of the database and format file here

Here's an example of two columns; one labels are not applied, one labels are applied.

test <- read_sas("person18.sas7bdat", "format17.sas7bcat")

attributes(test$ROLE) # labels are not applied
#> $format.sas
#> [1] "F17ROLE"
attributes(test$SFTYEQP) # labels are applied
#> $format.sas
#> [1] "F17SFTYEQP"
#> 
#> $class
#> [1] "haven_labelled"
#> 
#> $labels
#>                     Shoulder & Lap Belt                           Lap Belt Only 
#>                                     101                                     102 
#>                      Shoulder Belt Only                   Restraint Use Unknown 
#>                                     103                                     104 
#>            None Used - Vehicle Occupant           Restraint Used - Type Unknown 
#>                                     105                                     106 
#> Child Restraint System - Forward Facing    Child Restraint System - Rear Facing 
#>                                     107                                     108 
#>                            Booster Seat          Child Restraint - Type Unknown 
#>                                     109                                     110 
#>                          Not Applicable                                   Other 
#>                                     990                                     998
@hadley
Copy link
Member

hadley commented Apr 8, 2021

@evanmiller as usual I've forgotten how everything works, but this seems like it might be a ReadStat issue? (I still see the problem with today's ReadStat)

@hadley hadley added bug an unexpected problem or unintended behavior readstat labels Apr 8, 2021
gorcha added a commit that referenced this issue Feb 21, 2023
Maintains iconv hack from c1f9f19 and solaris hack from 4a878a1.

* Fix various SAS catalog file reading bugs (fix #529, fix #653, fix #680, fix #696, fix #705).
* Increase maximum SAS page file size to 16MB (fix #697).
* Ignore invalid SAV timestamp strings (fix #683).
* Fix compiler warnings (fix #707).
gorcha added a commit that referenced this issue Feb 22, 2023
Maintains iconv hack from c1f9f19 and solaris hack from 4a878a1.

* Fix various SAS catalog file reading bugs (fix #529, fix #653, fix #680, fix #696, fix #705).
* Increase maximum SAS page file size to 16MB (fix #697).
* Ignore invalid SAV timestamp strings (fix #683).
* Fix compiler warnings (fix #707).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior readstat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants