I have a large descriptive Table 1 that I'd like to try to export to an Excel file for a manuscript, where I describe people based on their vaccination history. I am using Stata/BE 17.0. I am relatively inexperienced with 'collect' and 'collect export' (and 'table', and 'putexcel', and a lot of other things), but I got the following code to work several times and then it started bombing! I am not sure what could have happened, but perhaps it's obvious to someone else.
Here is my code:
Code:
foreach item in var1 var2 var3 var4 var5 { table (`item') (vax_history), statistic(frequency) statistic(percent, across(`item')) nototals collect layout (`item') (vax_history#result) (), name(Table) collect export "C:\Users\me\exceldocument.xlsx", sheet(`item') modify }
putexcel_set_new(): 3010 attempt to dereference NULL pointer
<istmt>: - function returned error
r(3010);
I am at a loss for what to do with this code--it seems there are older Statalist posts about this being a bug in previous versions of Stata, but there was a note that it ought to have been fixed for Stata 17. Any insight on how I am managing to break this code would be very helpful!
Edited to add: I get the same error when I successfully produce a table (using inline code) and then try the table export mechanism under Statistics > Summaries, tables, and tests > Tables and collections > Build and style table.
Very best,
Maria
0 Response to Error message with 'collect export' in Stata 17
Post a Comment