When Stata Loops Stall, Move the Math to Mata
Stata loops often stall during heavy matrix algebra. Learn how to use Mata's compiled bytecode and explicit data transfer functions like st_data() to accelerate your compute kernels.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Stata loops often stall during heavy matrix algebra. Learn how to use Mata's compiled bytecode and explicit data transfer functions like st_data() to accelerate your compute kernels.
Goal: Determine whether the memory increase observed after repeated calls to the margins command in Stata reflects a true leak or expected caching of intermediate results, and whether clearing that memory requires a manual Mata workspace reset. Constraints: Reports differ across Stata versions; Stata 18 changed internal memory‑management for margins, but cer