I hope you all are safe during this pandemic situation. Hope we will see a better world soon.
I am facing issues with odkmeta command in STATA. Actually, few days before I use ODK briefcase for data download and there is no issue with that, but now in ODK central there is an option for data download in CSV format. When i use this data set in odkmeta it's showing - "datetime variable SubmissionDate could not be converted using the mask MDYhms".
Can anyone please help me out?
What version of Central are you using?
To see your version number, click on the question mark icon in the upper right section of your Central menu bar, then click
Version. If you don't see the question mark, you can also see the version number by adding "version.txt" to the root URL (e.g.,
Can you please share a screenshot of the issue?
Thanks for your reply! I am sharing with you the version details and screenshot for your easy reference.
70ec99f02885a06e37709db6319bfdf96fac84eb client (v1.2.2)
59556ecea91f0a25678cd6da0084adb7e66ca099 server (v1.2.1)
Hello @danbjoseph sir,
Any updates on the same. Actually I'm struggling in data conversion. Please help.
SubmissionDate coming from Central in the CSV is probably in a format like
The error message of "could not be converted using the mask MDYhms" is suggesting that STAT is expecting month, day, year, hour, minute, and second, in that order. The Central SubmissionDate is in the order of year, month, day, hour, minute, and second.
I found this manual that might help: https://www.stata.com/manuals/ddatetimeconversion.pdf
Hi Dan or anybody interested,
I am having this same date formatting issue with ODKmeta Stata import.
My Error running the odkmeta import do file: "datetime variable SubmissionDate could not be converted using the mask MDYhms"
Does anybody know the correct format for the following line of code in the odkmeta import script when using Central formatted datetimes?
local datetimemask MDYhms
I agree that it is probably an issue with my SubmissionDate format coming for Central in style that Stata isn't expecting. I tried changing the odkmeta import file that was generated from "local datetimemask MDYhms" to "local datetimemask YMDhms". That didn't work. I tried changing 2022-04-18T19:42:23.365Z to 2022-04-18T19:42:23 and it still doesn't work.
I then tried taking the ODK example files, which I got during the download of odkmeta by adding "all" and running those exactly. That works so I know that I know how to do it when using the example files. Then, I took the SubmissionDate from that working sample file and put it in my data manually, overwriting the submissiondate from Central to "12/19/2013 15:42:11 PM" and changed my import do file back to "MDYhms". It does not work and gives the same error as the beginning.
Please help! I am stuck.
for something formatted like this
can you maybe try
This worked!!!!! Thank you so much!
By the way, I also wrote to the tech support for ODK Meta and they said they don't officially support ODK Meta anymore but were nice enough to suggest:
replace SubmissionDate = substr(SubmissionDate, 1, strpos(SubmissionDate ,".") - 1)
replace SubmissionDate = subinstr(SubmissionDate, "T", " ", .)
Now, this does work in conjunction with changing "local datetimemask MDYhms" to "local datetimemask YMDhms" BUT it only fixes SubmissionDate but then if you have other datetime variables in your survey (I just added one to test) then it breaks again so your solution of changing "local datetimemask MDYhms" to "local datetimemask YMD#hms#" is a great solution to address all datetimes not just one individual datetime.
I only write all of this so other people who read through the comments with a similar issue will know what worked best for me. I have already solved another ODK Meta issue before this by reading through other people's comments. They are so useful!
Thanks again so much!!! I really appreciate your help.