Skip to content

Commit

Permalink
Respect variable format specs when writing STATA (#320)
Browse files Browse the repository at this point in the history
Closes #312.
  • Loading branch information
seidelma authored Dec 26, 2024
1 parent ba4392e commit 0367470
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bin/write/mod_readstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ static int handle_variable(int index, readstat_variable_t *variable,
readstat_type_t type = readstat_variable_get_type(variable);
const char *name = readstat_variable_get_name(variable);
const char *label = readstat_variable_get_label(variable);
const char *format = readstat_variable_get_format(variable);
size_t storage_width = readstat_variable_get_storage_width(variable);
int display_width = readstat_variable_get_display_width(variable);
int missing_ranges_count = readstat_variable_get_missing_ranges_count(variable);
Expand All @@ -180,6 +181,8 @@ static int handle_variable(int index, readstat_variable_t *variable,
readstat_variable_set_label_set(new_variable, label_set);
if (mod_ctx->is_sas7bdat) {
readstat_variable_set_format(new_variable, val_labels);
} else if (mod_ctx->is_dta) {
readstat_variable_set_format(new_variable, format);
}
}

Expand Down

0 comments on commit 0367470

Please sign in to comment.