I used Kobotoolbox and am now trying to get my data into STATA using odkmeta. I’ve gotten pretty far, but now I’m getting an error when I run the import do file odkmeta created when it gets to my first variable with a text response (the first “please specify other”).
Here is the section of the do file that precedes the error:
* Import ODK attributes as characteristics.
insheet using "mydata.csv", comma nonames clear
local fields
foreach var of varlist _all {
local field = trim(`var'[1])
assert `:list sizeof field' == 1
assert !`:list field in fields'
local fields : list fields | field
}
insheet using "mydata.csv", comma names case clear
unab all : _all
This runs fine, as do all the first several variables with numeric code responses. But then when I get here:
* caregroup_promoter_other
* Duplicate variable name with o_prefill_codes-caregroup_promoter
local pos : list posof "o_prefill_codes-caregroup_promoter_other" in fields
local var : word `pos' of `all'
I get invalid syntax after this last command.
Any help figuring this out would be much appreciated!
-Kate
Here is the section of the do file that precedes the error:
* Import ODK attributes as characteristics.
insheet using "mydata.csv", comma nonames clear
local fields
foreach var of varlist _all {
local field = trim(`var'[1])
assert `:list sizeof field' == 1
assert !`:list field in fields'
local fields : list fields | field
}
insheet using "mydata.csv", comma names case clear
unab all : _all
This runs fine, as do all the first several variables with numeric code responses. But then when I get here:
* caregroup_promoter_other
* Duplicate variable name with o_prefill_codes-caregroup_promoter
local pos : list posof "o_prefill_codes-caregroup_promoter_other" in fields
local var : word `pos' of `all'
I get invalid syntax after this last command.
Any help figuring this out would be much appreciated!
-Kate
Comment