Publication:
Cache: A Generalized Mechanism for Storing and Replaying any Stata Command

Loading...
Thumbnail Image
Files in English
English PDF (366.21 KB)
45 downloads
English Text (56.72 KB)
16 downloads
Published
2025-07-02
ISSN
Date
2025-07-02
Editor(s)
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.
Link to Data Set
Citation
Castañeda, R.Andrés; Clarke, Damian. 2025. Cache: A Generalized Mechanism for Storing and Replaying any Stata Command. Global Poverty Monitoring Technical Note; 43. © World Bank. http://hdl.handle.net/10986/43412 License: CC BY-NC 3.0 IGO.
Digital Object Identifier
Associated URLs
Associated content
Report Series
Other publications in this report series
Journal
Journal Volume
Journal Issue
Collections

Related items

Showing items related by metadata.

  • Publication
    Estimating Global Poverty in Stata
    (World Bank, Washington, DC, 2019-09) Castaneda Aguilar, R. Andres; Lakner, Christoph; Prydz, Espen B.; Soler Lopez, Jorge; Wu, Ruoxuan; Zhao, Qinghua
    This note describes how poverty measures reported by the World Bank can be replicated using the Stata command povcalnet. Users can estimate poverty at any poverty line for the world, regions or sets of countries, by directly querying the World Bank's database of household surveys. The command also retrieves inequality statistics provided by the database.
  • Publication
    Perils of Simulation : Parallel Streams and the Case of Stata’s Rnormal Command
    (World Bank, Washington, D.C., 2012-11) Owen Ozier
    Large-scale simulation-based studies rely on at least three properties of pseudorandom number sequences. Since they behave like random numbers, they can be replicated and generated in parallel. However, there has been some divergence between empirical techniques employing random numbers and the standard battery of tests used to validate them. A random number generator that passes tests for any single stream of random numbers may fail the same tests when it is used to generate multiple streams in parallel. The lack of systematic testing of parallel streams leaves statistical software with important potential vulnerabilities. This paper reveals one such vulnerability in Stata's rnormal function which went unnoticed for almost four years and how this error was detected. Furthermore, the paper discusses practical implications for the use of parallel streams in existing software.
  • Publication
    A General Equilibrium Analysis of Demand Side Management Programs under the Clean Development Mechanism of the Kyoto Protocol
    (World Bank, Washington, DC, 2008-03) Timilsina, Govinda R.
    This paper analyzes the economic and environmental consequences of a potential demand side management program in Thailand using a general equilibrium model. The program considers replacement of less efficient electrical appliances in the household sector with more efficient counterparts. The study further examines changes in the economic and environmental effects of the program if it is implemented under the clean development mechanism of the Kyoto Protocol, which provides carbon subsidies to the program. The study finds that the demand side management program would increase economic welfare if the ratio of unit cost of electricity savings to price of electricity is 0.4 or lower even in the absence of the clean development mechanism. If the program's ratio of unit cost of electricity savings to price of electricity is greater than 0.4, registration of the program under the clean development mechanism would be needed to achieve positive welfare impacts. The level of welfare impacts would, however, depend on the price of carbon credits the program generates. For a given level of welfare impacts, the registration of the demand side management program under the clean development mechanism would increase the volume of emission reductions.
  • Publication
    Applying Market Mechanisms to Central Medical Stores : Experiences from Burkina Faso, Cameroon, and Senegal
    (World Bank, Washington, DC, 2010-07) Govindaraj, Ramesh; Herbst, Christopher H.
    This study summarizes the findings of three assessments of Central Medical Store (CMS) reform and performance in Francophone Africa. The study aims to document and characterize the organizational reform of the CMSs and the impact of the reform on CMS management and performance in Cameroon, Burkina and Senegal. It seeks further to assess the extent to which increased autonomy brought about by such 'marketizing' reforms has had an impact on intermediate CMS results, service quality, product quality, and access to medicines. The findings indicate that organizational reform did contribute towards improving operational performance which, in turn, influenced service quality, product quality, and access to CMS-supplied medicine in these countries. However, improvements in these areas were premised not simply on increased autonomy, but on a whole variety of drivers, both internal and external to a CMS. These include a strong regulatory framework, the conventions, laws, regulations, and administrative acts that increase the flexibility of some decision making rights, whilst constraining others, with an emphasis on social obligations, accountability, and transparency, as well as external factors, such as technical assistance, government subsidies, and relevant external policies, institutions and regulations. The paper ends by proposing a framework that could be used both for the design as well as for the analysis of marketizing reforms in CMSs and other public sector commodity supply entities in developing countries. The framework is sufficiently general that, with some modifications, it could also be applied usefully to the design and analysis of such reform in other public sector institutions delivering social services.
  • Publication
    SAE - A Stata Package for Unit Level Small Area Estimation
    (World Bank, Washington, DC, 2018-10) Nguyen, Minh Cong; Corral, Paul; Azevedo, Joao Pedro; Zhao, Qinghua
    This paper presents a new family of Stata functions devoted to small area estimation. Small area methods attempt to solve low representativeness of surveys within areas, or the lack of data for specific areas/sub-populations. This is accomplished by incorporating information from outside sources. Such target data sets are becoming increasingly available and can take the form of a traditional population census, but also large scale administrative records from tax administrations, or geospatial information produced using remote sensing. The strength of these target data sets is their granularity on the subpopulations of interest, however, in many cases they lack the ability to collect analytically relevant variables such as welfare or caloric intake. The family of functions introduced follow a modular design to have the flexibility with which these can be expanded in the future. This can be accomplished by the authors and/or other collaborators from the Stata community. Thus far, a major limitation of such analysis in Stata has been the large size of target data sets. The package introduces new mata functions and a plugin used to circumvent memory limitations that inevitably arise when working with big data. From an estimation perspective, the paper starts by implementing a methodology that has been widely used for the production of several poverty maps.

Users also downloaded

Showing related downloaded files

  • Publication
    Mongolia Country Climate and Development Report
    (Washington, DC: World Bank, 2024-10-22) World Bank Group
    Mongolia’s development prospects are uniquely challenged by both the impacts of climate change and the global shift toward a low-carbon economy. The country’s efforts toward decarbonization pose significant challenges given the structurally high-emission intensity of its economy. While challenging, climate action also presents Mongolia with opportunities to achieve important development benefits. The effects of climate risks and the shift away from coal will have diverse impacts across different regions, communities, and socioeconomic levels. The report assesses the critical interconnections between Mongolia’s development ambitions and climate change action and identifies ways to transition to a more economically diversified, inclusive, and resilient development path. It highlights key climate and transition risks affecting Mongolia’s future development and presents a pathway to enhance climate mitigation and adaptation. The report also makes a case for strengthening policies to enhance resilience to climate change and ensure a just transition, particularly for the most vulnerable. The report is structured as follows: section 1 gives introduction. Section 2 delves into the linkages between development and climate in Mongolia and presents model-based findings on the economic and poverty impacts of climate change under different scenarios. Section 3 covers four in-depth sectoral analyses. The first two mainly focus on adaptation to climate change in the agriculture and water sectors. The third considers prospects for the extraction sector, while the fourth sectoral analysis focuses on decarbonizing power and heat generation. Section 4 shifts the focus to how the government can boost resilience for climate-vulnerable populations. Section 5 outlines options for mobilizing private and public financing and private investments to support the green transition. Section 6 examines the existing institutional and governance structure for climate action and presents recommendations to improve its effectiveness, and section 7 concludes with a framework for prioritizing the policy actions outlined in this report.
  • Publication
    Comoros Country Climate and Development Report
    (Washington, DC: World Bank, 2025-06-18) World Bank Group
    The Union of the Comoros (The Comoros) has significant vulnerability to climate change-related risks but has considerable opportunities to strengthen preparedness and resilience against these challenges. According to the Notre Dame Global Adaptation Index, the Comoros is the 29th-most vulnerable country to climate change and the 163rd most ready to adapt (out of 191). The Comoros archipelago is exposed to many natural hazards that adversely affect the country’s natural capital, people, and physical infrastructure. In 2014, the economic cost of climate-related disasters was estimated at 5.7 million dollars annually, equivalent to 9.2 percent of Gross Domestic Product (GDP). Between 2018 and 2023, as many as 11 tropical depressions or cyclones impacted the country, with Cyclone Kenneth causing the greatest damage, equivalent to 14 percent of GDP, resulting in total economic growth falling from 3.6 percent in 2018 to 1.9 percent in 2019. More than 345,000 people (40 percent of the population) were affected by the cyclone, with 185,000 people experiencing severe impacts and 12,000 people displaced. However, there is an opportunity for the country to grow more robust and shock-responsive, and to establish pre-positioned funding mechanisms to enhance future crisis response efforts. For the Comoros, adaptation and climate-resilient development are the key climate change focus areas, with the country projected to face 836 million dollars 2050 in additional costs due to climate-related impacts. Current plans to adapt to the impacts of climate change in the Comoros include efforts to improve water management, strengthen coastal protection, and develop climate-smart agriculture practices. Given the country’s reliance on its natural resource base for economic growth and mobility, protection of these resources from climate change will be essential for promoting resilient growth and development. In addition to growing the adaptive capacity of the country’s natural resource sectors, strategic economic diversification will be important to help minimize future climate impacts, and development activities will need to be undertaken in such a way as to attract low-carbon co-benefits. The Union of the Comoros is committed to addressing climate change through its Nationally Determined Contribution (NDC) and national priorities. The country’s NDC (which was revised in 2021 for a ten-year horizon) sets ambitious targets, with a goal of reducing greenhouse gas emissions by 23 percent by 2030. The country also plans to significantly increase the share of renewable energy in its energy portfolio, reaching 33 MW by 2030. This will not only promote low-carbon development but also reduce the country’s dependency on imported oil and coal, which currently make up 95 percent of the energy mix. Additionally, the Comoros has declared its intention to increase CO2 removals by 47 percent by 2030, compared to BAU.
  • Publication
    Kyrgyz Republic Country Climate and Development Report
    (Washington, DC: World Bank, 2025-11-03) World Bank Group
    This Country Climate and Development Report (CCDR) on the Kyrgyz Republic aims to support the country’s development goals amid a changing climate. The CCDR considers two policy scenarios up to 2050: the business-as-usual (BAU) and high-growth scenarios. As it quantifies the likely impacts of climate change on the Kyrgyz economy between now and 2050, the report highlights key government actions to best prepare for and adapt to climate impacts (referred to as “with adaptation” measures), with a particular focus on the time horizon up to 2030. The CCDR also outlines a path to net zero emissions by 2050 (referred to as “with mitigation” measures, “decarbonization,” or, simply, “net zero 2050”), highlighting associated development co-benefits.
  • Publication
    Guinea-Bissau Country Climate and Development Report
    (Washington, DC: World Bank, 2024-10-23) World Bank Group
    Guinea-Bissau is endowed with a wealth of natural resources, with the highest natural capital per capita in West Africa (US3,874 dollars per capita), which could be leveraged for sustainable and resilient growth. However, Guinea-Bissau faces significant development hurdles, such as high poverty rates, political instability, and economic challenges, including an over-reliance on cashew nuts. Rural poverty has increased, and the nation's infrastructure, education, and health care systems are underdeveloped. Climate change poses a severe threat, potentially impacting agriculture, fisheries, and infrastructure. Without adaptation, it could lead to a significant cut in real GDP per capita (minus 7.3 percent by 2050) and increase in poverty (with up to over 200,000 additional poor by 2050, that is, 5 percent of the expected population, in the worst scenario). The country's low greenhouse gas emissions are expected to rise, mainly due to agriculture and land-use changes, with deforestation being a major contributing factor. Although Guinea-Bissau is a low emitter, it has high mitigation ambitions, targeting a 30 percent reduction in greenhouse gas emissions by 2030. The Nationally Determined Contribution outlines significant climate actions, with initiatives focused on forest conservation, sustainable agriculture, and community development. However, the country's political instability, institutional weaknesses, and limited financial resources pose challenges to implementing these climate commitments, which depend heavily on external funding. The financial sector's underdevelopment and vulnerability to external shocks limit its ability to support green investments, though reforms could enhance resilience. Guinea-Bissau must consider its climate financing as development financing and vice-versa, engage the private sector, and integrate climate goals with national development plans to ensure a sustainable future. Concessional climate financing is vital due to the underdeveloped financial sector and the government’s limited borrowing capacity. Addressing Guinea-Bissau's vulnerability to climate change and its structural issues requires a cohesive approach that integrates development and climate strategies. This could involve improving governance, diversifying the economy, protecting natural capital, developing human capital, and investing in sustainable agriculture and infrastructure. The transition to a more sustainable and inclusive development pathway that supports economic growth is possible, but requires focusing on key strategic sectors, enhancing institutional capacity, and creating the conditions to mobilize finance. As a highly vulnerable country, there are myriad needs in the different sectors; however, to be more efficient and effective, Guinea-Bissau should prioritize actions in a few sectors, especially actions on biodiversity, agriculture, and social protection. Low carbon development, especially in energy and forestry sectors, could provide cost-efficient solutions and attract climate finance, including from the private sector, which will support the overall development agenda.
  • Publication
    Jobs in a Changing Climate: Insights from World Bank Group Country Climate and Development Reports Covering 93 Economies
    (Washington, DC: World Bank, 2025-11-05) World Bank
    The World Bank Group’s Country Climate and Development Reports (CCDRs) provide a crosscutting look at how countries’ development prospects, and the job opportunities they offer to their people, can be threatened by climate impacts and supported by climate policies. Climate change and policies affect jobs through impacts on productivity, energy and material efficiency, and physical, human, and natural capital. They can also transform employment opportunities, especially through complementary measures that help workers and firms adapt to and benefit from new technologies and production practices. Prepared by the World Bank, the International Finance Corporation (IFC), and the Multilateral Investment Guarantee Agency (MIGA), CCDRs integrate country perspectives, climate science and economic modeling, private sector information, and policy analysis to assess how countries can successfully grow and develop their economies and create jobs despite increasing climate risks and while achieving their climate objectives and commitments. Each CCDR starts from the country’s development priorities, opportunities, and challenges, and is developed in close consultation with governments, businesses, and civil society, ensuring the recommendations reflect national priorities. By combining evidence on adaptation, resilience, and emissions pathways, CCDRs highlight where climate action can reinforce development and job creation, and where targeted policies are needed to manage risks and smooth labor market transitions. Taken together, these elements can help create local jobs, ensure economic transitions are just and inclusive, and equip workers and firms to navigate the disruptions and opportunities of a changing climate and changing technologies.