Skip to content

Commit 102d830

Browse files
authored
Allow 32 character variable names for stata (#616)
Fixes #605
1 parent 078dd6b commit 102d830

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# haven (development version)
22

3+
* `write_dta()` now allows variable names up to 32 characters (@sbae, #605).
4+
35
* Fix issue with `read_dta()` crashing R when StrL variables with missing values
46
were present (@gorcha, #594, #600, #608).
57

R/haven-stata.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ validate_dta <- function(data, version) {
101101

102102
# Check variable names
103103
bad_name <- !grepl("^[A-Za-z_]{1}[A-Za-z0-9_]+$", names(data))
104-
bad_length <- nchar(names(data)) > 31
104+
bad_length <- nchar(names(data)) > 32
105105
bad_vars <- if (version >= 14) bad_length else bad_length || bad_name
106106
if (any(bad_vars)) {
107107
stop(

0 commit comments

Comments
 (0)