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
When the odkmeta generated do-file creates the stata dataset, it is inconsistently generating the same variable as both string and byte for different version of the survey.
For example, if there are no observations for a text variable in one version of the survey, the text variable is generated as a byte. In another version of the survey where is there is an observation, it is correctly generated as a string. This is creating problems when we try to append the survey versions for a compiled dataset.
Do you know why this is happening? And, is there a way to fix this with the command, or will it require editing the code in the do-file?
The text was updated successfully, but these errors were encountered:
I think a reasonable enhancement would be to convert string fields imported as numeric back to string.
The following code could be added almost anywhere in the .dta loop, e.g., before select_multiple fields are split:
local strvars
local strtypes text audio image video
ds, has(type numeric)
if "`r(varlist)'" != "" ///
ds `r(varlist)', has(char Odk_type)
foreach var in `r(varlist)' {
loc type : char `var'[Odk_type]
if `:list type in strtypes' | `:char `var'[Odk_is_other]' ///
local strvars : list strvars | var
}
if `:list sizeof strvars' {
tostring `strvars', replace format(%24.0g)
foreach var of local strvars {
replace `var' = "" if `var' == "."
}
}
We should also make a note in the help file about issues that insheet could introduce here. E.g., we could not distinguish the string value "1" from "01".
Request over e-mail:
The text was updated successfully, but these errors were encountered: