AN ORDERED PROBIT PMT MODEL ON SYNTHETIC SUSENAS 2022-2025
==========================================================

The task
--------

Build a proxy means test (PMT) from four rounds of synthetic Susenas data, exactly as a
programme would: estimate the model on 2022-2024, predict 2025, and measure how well the
prediction targets the poorest half.

You are given four do files. Each one is complete for the first case and stops where the
pattern repeats. Finish them so that they run from start to end and print reference_output.txt
exactly - every row count, every checkpoint table, every coefficient, every targeting error.

Where to get the data
---------------------

Download synthetic_susenas_2022-2025_stata_release.zip (323 MB) from
    https://github.com/anshory1972/miktrik2026/releases/tag/pmt-data-v1
and unzip it anywhere. Optional, not needed for the assignment: the Stata program that
generates the synthetic data, synthetic_susenas_mc_generator_student.zip, is on the same page.

What the package contains
-------------------------

    2022_maret/  2023_maret/  2024_maret/  2025_maret/
        KOR/          the household file and the individual file(s), dBase format
        KP/           the consumption modules: BLOK43 (totals) and BLOK42 (three items)
        kuesioner/    the questionnaires
        metadata_bps/ the BPS variable lists
        Metadata_Synthetic_Susenas_YYYYMM.xlsx   the variable list of this release
    poverty_line_2022_2025.csv   the published BPS poverty line, province by urban/rural

The four do files, and what is done for you
-------------------------------------------

Run them one after another, in order, each with  do  . Each file opens with the path line(s)
to edit and writes its own log into the work folder. There is no master file.

    s0_import.do       edit pkg (the unzipped package) and work (a folder for Stata files);
                       read every dBase file, append the province-range splits
                       done: March 2022 and the poverty line   yours: 2023, 2024, 2025
    s1_build.do        one household record per round: collapse the person file, reshape
                       module 42, merge, check, build the model variables; then deciles
                       done: March 2022 and the deciles        yours: 2023, 2024, 2025
    s2_pmt_ols.do      1. the PMT, thirty-nine proxies, district fixed effects
                       2. the parsimonious model, district fixed effects
                       done: the sample and the recodes      yours: models 1 and 2
    s3_pmt_ordered.do  3. ordered probit on the decile, the PMT, district fixed effects
                       4. ordered probit on the decile, the parsimonious model
                       5. inclusion and exclusion error at the bottom 50 per cent, four models
                       done: the load only                   yours: models 3, 4 and all of 5

Each place where your code goes is marked  >>> write ... here <<<

Rules
-----

- The reference output is the answer. A number that differs means something upstream
  differs. Step 1 prints a checkpoint table for every round; if yours matches, the build
  of that round is right, and you can move on.
- Not all Susenas rounds are the same. File names, the number of files a module is split
  into, and variable names all change between rounds. Read the folder and the metadata
  workbook of each round before you write its block.
- Paths use forward slashes. Stata accepts them on Windows, and a backslash before a
  macro name is read as an escape character, which fails silently.
- Runtime on a four-core machine: about two minutes for the import, four for the build, four
  for the linear models, six for the ordered probits.

What to hand in
---------------

The four completed do files and the four logs they write (s0_import.log ... s3_pmt_ordered.log,
in the work folder).
