.. _waf:


***
Waf
***

Documentation on the rationale, Waf, and more background is at http://hmgaudecker.github.io/econ-project-templates/ in the context of the Python version of this template.

For this project you need STATA as all estimation and data management steps were accomplished using this software.

.. _getting_started:

Getting Started
===============

**This assumes you have completed the steps in the** `README.md file <https://github.com/hmgaudecker/econ-project-templates/tree/stata#templates-for-reproducible-research-projects-in-economics>`_ **and everything worked.**

The logic of the project works along the following steps:

1. Data management
2. Visualisation and results formatting
3. Putting everything into the paper


.. _project_paths:

Project Paths
=============

A variety of project paths are defined in the top-level wscript file. These are exported to be used in header files in other languages.
The following is taken from the top-level wscript file. Modify any project-wide path settings there.

.. literalinclude:: ../../wscript
    :start-after: out = "bld"
    :end-before:     # Convert the directories into Waf nodes

As should be evident from the similarity of the names, the paths follow the steps of the analysis in the :file:`src` directory:

    1. **data_management** → **OUT_DATA**
    2. **final** → **OUT_FIGURES**, **OUT_TABLES**

These will re-appear in automatically generated header files by calling the ``write_project_paths`` task generator (just use an output file with the correct extension for the language you need -- ``.py``, ``.r``, ``.m``, ``.do``).

By default, these header files are generated in the top-level build directory, i.e. ``bld``. Since this is where Stata is launched, you can just get globals with the project paths by adding a line ``include project_paths`` at the top of you do-files.

To see what these variables are, here is the content of *bld/project_paths.do*:

.. literalinclude:: ../../bld/project_paths.do

.. note::

    Note the changes to Stata's built-in system pathse. **These changes imply that Stata will not find any packages you installed system-wide anymore.** It is desired behaviour to keep the project self-contained.