Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Code for negative values #6

Open
srpatil1976 opened this issue May 9, 2022 · 1 comment
Open

Multiple Code for negative values #6

srpatil1976 opened this issue May 9, 2022 · 1 comment

Comments

@srpatil1976
Copy link

You have been a great help by solving a previous issue in coding of 0-1 response. Thank you very much. We have noticed another issue as follows and hope you can help.

When splitting select_multiple variables into several Boolean (0-1) variables, the code considers only positive values such as 0, 1, ..96 etc. However, if the code is negative, e.g., -99 for dont know or -97 for refused, then Bollean variables for these values is not created. We feel the issue could be because new variables with suffix has to be created such as varname_0, varname_3, varname_95 etc, but in case of a negative number this could be a problem. Is it possible to create a variable with underscore instead of negative value such as varname__99, varname __97 etc?

We wish we knew python to just help you write this code ourselves. Thank you for much for your help and willingness to update and maintain odk2stata.

Best
Sumeet

@jkpr
Copy link
Owner

jkpr commented May 9, 2022

If you run python -m odk2stata.dofile.settings you get the default settings:

[DEFAULT]
skip = False
omit = False
dataset_source = briefcase
which_label = first_label
extra_label = o2s_label

[destring]
odk_names_to_destring =

[drop_column]
types_to_drop = note
odk_names_to_drop =
odk_names_not_to_drop =

[encode_select_one]
encode_select_ones = True
encode_external_select_ones = False
odk_names_to_encode =
odk_names_not_to_encode =
choice_lists_not_to_encode =
number_column = o2s_number
strict_numbering = False
label_replace_column = first_label

[label_variable]
first_paragraph_only = False
remove_numbering = True
stop_at_words =
stop_before_words =

[metadata]
author =
timestamp_format = %Y-%m-%d, %H:%M:%S
case_preserve = False
merge_single_repeat = True
merge_append = True
odk2stata_version = 0.2.6

[rename]
direct_rename =
rename_to_odk_name = True

[split_select_multiple]
default_split_method = append_number
binary_option_label = yes_no
binary_label = o2s_binary_label
choices_to_exclude = negative_numbers
choice_lists_to_split =
choice_lists_not_to_split =
odk_names_to_split =
odk_names_not_to_split =
odk_names_to_append_name =
odk_names_to_append_number =
odk_names_to_name_only =
number_column = o2s_number
strict_numbering = False

If you look under split_select_multiple, there is a setting called choices_to_exclude. In your settings file (you are using one, right?) try setting that to none or removing the value altogether. Then re-run odk2stata and see if you like what you get.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants