asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › “Tab” Conformability Error
Tagged: conformability error, tab
-
AuthorPosts
-
I’m running into an error when trying to create a cross tab using “tab”. The exact error is:
COMMAND
asdocx tab studyid do_they_require_an_interpr_mi if do_they_require_an_interpr_mi==0
RESULT
asdocx_tab_twovars(): 3200 conformability error - function returned error r(3200);
Without the asdocx prefix, the results are:
COMMAND
tab studyid do_they_require_an_interpr_mi if do_they_require_an_interpr_mi==0 RESULT no observations
My best guess is that this has to do with trying to create a table where no observations exist. However, this command is part of a larger loop, and sometimes there will be results, while other times there won’t be. Happy to send a more detailed error output per SET TRACE ON.
Any suggestions?
Hi Dr. Shah — I’ve confirmed that the “no observations” scenario is the issue.
CODE:
. sys use auto . tab make foreign if make=="Subaru" | Car origin Make and model | Foreign | Total -------------------+-----------+---------- Subaru | 1 | 1 -------------------+-----------+---------- Total | 1 | 1 . tab make foreign if make=="Subaru" & foreign==0 no observations . asdocx tab make foreign if make=="Subaru" & foreign==0 no observations asdocx_tab_twovars(): 3200 conformability error - function returned error r(3200);
Is this something you’d be able to tweak in the program code to allow for?
I agree that asdocx should report a proper error message, instead of the function’s conformability error. I shall work on it and update it. Having said that, you can overcome the no observation error with the
capture
prefix. Therefore, if there is any such error, the code will run without throwing the said error and breaking the execution of the rest of the code.sysuse auto , clear capture asdocx tab make foreign if make=="Subaru" & foreign==0
Fantastic. Thank you!
One more thing: I’m trying to do an XLSX export, as well as a DOCX export: the DOCX works fine, but I’m getting the following error for XLSX:
COMMAND:
asdocx list studyid, save(test.xlsx)
RESULT:
invalid column range: starting column 1 is after ending column 0
Happy to provide a more detailed output if you like.
Thanks so much,
KevinWhen a table had a single column, the Excel routine will throw the mentioned error. This has been fixed. You may update asdocx.
Thank you! I’ve also discovered another bug, though it might be a feature.
I’m looping over variables to create a “First Look” document, where each variable has its basic information included above its simple TAB. My code is in the following loop:
asdocx collect on asdocx, text(This is the beginning of the document.) save("First Look") replace foreach var of varlist * { collect: asdocx describe
var’, det
collect: asdocx tabvar', lab dec(1) tzoc title("VARIABLE:
var'”) mi
}
asdocx export
asdocx collect off
`
However, there’s an error on the “describe” command; the “detail” option is not allowed. When the “detail” option is removed, asdocx treats the “describe” command as if being applied to all variables. It seems to ignore the [variable] specifier in the original “describe” command.I’ve tried to find a way around this issue by looking for some sort of community-contributed program that stores variable descriptives (type, etc) in a macro, but I can’t find anything. Is this something to be fixed or is this how it is intended to function?
Thanks!
Sorry about the formatting of the above post. Not sure how to fix it — the “Edit” option is no longer available or else I’d make it easier to read!
-
AuthorPosts
- You must be logged in to reply to this topic.