I tried to use tab2xl in a loop to generate sheets faster, but after running the code there's no file generated, stata didn't report error as well.
I created three dummy variable apple,pear and orange, and I wanted to tab the variable "list" if the dummy variable is 1:
I created three dummy variable apple,pear and orange, and I wanted to tab the variable "list" if the dummy variable is 1:
Code:
input str10 fruit
apple
pear
orange
end
levelsof fruit, local(fruit)
foreach a of local fruit {
tab2xl list if `a' == 1, using "test3.xls", sheet("`a'") row(1) col(1) append excel($append)
}

Comment