-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Description
Stata has a variable length limit of 32 characters. However, you can export data with variable names over 32 characters from R using write_dta. The result will successfully read into Stata, but you can't perform any operations on the variable or even rename it to something shorter. It's virtually inoperable. Therefore, I think a good addition to haven would be to give an error when exporting dataframes that include variable names with more than 32 characters, or at least a warning to shorten the variable names. Quick example below, including the Stata code that causes errors.
library(haven)
test <- data.frame("a_variable_name_with_too_many_characters" = 1)
write_dta(test, "test.dta")
##Stata code below
use "test.dta", clear
tab a_variable_name_with_too_many_characters
ren a_variable_name_with_too_many_characters shorter_varname
Andrei-WongEagadjanian and jacobkap
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior