世界银行-缓存:一种用于存储和重放任何Stata命令的通用机制(英)
Global Poverty Monitoring Technical Note 43 CACHE A Generalized Mechanism for Storing and Replaying Any Stata Command R.Andrés Castañeda and Damian Clarke May, 2025 Keywords: Cache; Stata programming; computational efficiency Development Data Group Development Research Group Poverty and Equity Global Department Public Disclosure AuthorizedPublic Disclosure AuthorizedPublic Disclosure AuthorizedPublic Disclosure AuthorizedGLOBAL POVERTY MONITORING TECHNICAL NOTE 43 Abstract In this paper we describe the Stata program cache, which allows for the full output of any Stata command to be cached to disk, enabling easy recovery of command output in the future without the need for re-computation. The cache program interacts with any native Stata or user-written command, allowing for caching of any elements returned by Stata commands, including matrices, scalars, graphs, data and frames, as well as command output itself. This command is useful for improving programming practices and efficiency, particularly in cases where the underlying Stata commands are computationally intensive and slow to run. All authors are with the World Bank. Clarke is also affiliated with the University of Chile and University of Exeter. Corresponding author: acastanedaa@worldbank.org. The authors would like to thank Christoph Lakner, Daniel Mahler, and Nishant Yonzan for comments and useful suggestions. The authors gratefully acknowledge financial support from the UK government through the Data and Evidence for Tackling Extreme Poverty (DEEP) Research Programme. The Global Poverty Monitoring Technical Note Series publishes short papers that document methodological aspects of the World Bank’s global poverty estimates. The papers carry the names of the authors and should be cited accordingly. The findings, interpretations, and conclusions expressed in this paper are entirely those of the authors. They do not necessarily represent the views of the International Bank for Reconstruction and Development/World Bank and its affiliated organizations, or those of the Executive Directors of the World Bank or the governments they represent. Global Poverty Monitoring Technical Notes are available at https://pip.worldbank.org/publication. 1. INTRODUCTION11IntroductionDespite advances in Stata’s analytical capacity, increasingly complex datasets and sta-tistical algorithms often require significant computation time. Thus, tools that enhancecomputational efficiency can significantly reduce processing time and resource consump-tion. In this article, we introduce one such general programming tool which can greatlyimprove the efficiency of programming in Stata: cache.cache is a prefix command which allows for the output of any Stata commandto be cached, allowing them to be retrieved later without re-executing the underlyingstatistical computations.cache can be used as a precursor to any native or user-written Stata program, and automatically saves all output including
世界银行-缓存:一种用于存储和重放任何Stata命令的通用机制(英),点击即可下载。报告格式为PDF,大小0.52M,页数25页,欢迎下载。
