Export dataframe to SAS file with extension .sas7bdat

FWIW, I'm an R user and SAS user and I've given up on the write_sas in haven a long time ago. read_sas works but I just write to csv if I need to use something in SAS from R. Something as simple as this doesn't open in SAS and they are all valid variable names:

library(haven)
library(tidyverse)
mtcars %>% as_tibble(rownames = "car") %>%
   write_sas("mtcars.sas7bdat")

Created on 2021-11-29 by the reprex package (v2.0.1)

SAS Universal Viewer gives an error that "Unable to load table mtcars. One common cause is when the table has an associated index which was not found".

2 Likes