You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
odkmeta splits select_multiple variables, with the number of new variables equal to the number of choices of the associated list. This ensures that the datasets created by the odkmeta do-file always have the same number of variables, regardless of what the data looks like. This is usually what you want, but if a list has many choices, it may be better to create only as many variables as are absolutely needed, in order to minimize the number of variables in the datasets.
To do this, replace the following code in the odkmeta do-file:
capture confirm numeric variable `var', exact
if !_rc {
local parts
local next 1
}
else {
split `var'
local parts `r(varlist)'
local next = `r(nvars)' + 1
destring `parts', replace
}
forvalues i = `next'/`nparts' {
local newvar `var'`i'
generate byte `newvar' = .
local parts : list parts | newvar
}
with this:
capture confirm numeric variable `var', exact
if !_rc {
generate byte `var'1 = .
local parts `var'1
}
else {
split `var'
local parts `r(varlist)'
local next = `r(nvars)' + 1
destring `parts', replace
}
local nparts : list sizeof parts
I'm hesitant to make this an actual option, as it's such an easy fix, but perhaps we could add these instructions to the help file. @internetlindsey, thoughts?
The text was updated successfully, but these errors were encountered:
odkmeta
splitsselect_multiple
variables, with the number of new variables equal to the number of choices of the associated list. This ensures that the datasets created by theodkmeta
do-file always have the same number of variables, regardless of what the data looks like. This is usually what you want, but if a list has many choices, it may be better to create only as many variables as are absolutely needed, in order to minimize the number of variables in the datasets.To do this, replace the following code in the
odkmeta
do-file:with this:
I'm hesitant to make this an actual option, as it's such an easy fix, but perhaps we could add these instructions to the help file. @internetlindsey, thoughts?
The text was updated successfully, but these errors were encountered: