*! version 0.1.0 2013-12-06 | vanheuvelen long

* tpr: create globals used to define variables, tests
*      create matrices populated during simulations

program define tpr_sim_loopsetup

    timer clear
    timer on 1

    if ($samplesize!=$sample_smallest) use $popdta, clear
    local samplesize "$samplesize"
    keep id-e s`samplesize'i*
    * most cases are selected at least once so no cases can be dropped

    * # of sample selection vars
    if ("`samplesize'"=="100") global sample_maxdrawn ///
                                    = $sample_maxdrawn*$sample_100factor
    global difficult ""
    if ("$samplesize"=="100") global difficult "difficult"
    if ("$samplesize"=="150") global difficult "difficult"

    capture matrix drop OLmat
    capture matrix drop BRmat
    capture matrix drop GLmat
    capture matrix drop WAmat
    capture matrix drop LRmat
    capture matrix drop PRmat
	capture matrix drop OPmat
    foreach nm of varlist $x_names {
        capture matrix drop WA`nm'mat
        capture matrix drop BR`nm'mat
    }

end