Parses a STATA .do file and translates its commands into metasurvey step call strings suitable for use in Recipe objects.
Value
A list with:
steps: character vector of step call strings
labels: list with var_labels and val_labels (if label commands found)
warnings: character vector of MANUAL_REVIEW items
stats: list with command counts
See also
Other transpiler:
parse_do_file(),
parse_stata_labels(),
transpile_coverage(),
transpile_stata_module()
Examples
# \donttest{
tf <- tempfile(fileext = ".do")
writeLines(c("gen age2 = edad^2", "replace sexo = 1 if sexo == ."), tf)
result <- transpile_stata(tf)
result$steps
#> [1] "step_compute(svy, age2 = edad^2, sexo = data.table::fifelse(is.na(sexo), 1, sexo))"
result$stats
#> $translated
#> [1] 2
#>
#> $skipped
#> [1] 0
#>
#> $manual_review
#> [1] 0
#>
# }