Hello all,
I have a loop which is not working. The error message is the following:
"<=4 invalid name"
I have a loop which is not working. The error message is the following:
"<=4 invalid name"
Code:
*M is the number of industries - rows of the matrices*
global M = 22
*N is the number of simulations - columns of the matrices*
global N = 4
gen lowskill = 1 if CGEskills == 1 | CGEskills == 2
local m = 1
local n = 1
* Options:
* a) Standard approach: use (un)employment probabilities directly in determining who loses jobs & target jobs at sub-min workers
* b) Hertz approach : use randomly generated probabilities, weight them by wage gap (probweight) & target jobs at sub-min workers
* c) Random aproach : use randomly generated probabilities and no targeting (this should replicate implicit job loss in CGE)
* If covered = 1 then probweight (wage gap) is only defined for covered workers below the minwage
***KP: This is the STANDARD setup
gen pru_sim = pru_unemp if covered == 1
gsort +ACTPHDSAM +lowskill -pru_sim
* Loops to assign job losses/gains to individuals and by sector
while `n' <= $N {
gen usjobloss`n' = 0
while `m' <= $M {
gen cumulwgt = 0
replace cumulwgt = pweight if ACTPHDSAM == `m'
replace cumulwgt = cumulwgt + cumulwgt[_n-1] if ACTPHDSAM == `m' & cumulwgt[_n-1] ~= .
replace usjobloss`n' = 1 if unskilljobs[`m',`n'] < 0 & cumulwgt <= abs(unskilljobs[`m',`n']) & ACTPHDSAM == `m'
local m = `m' + 1
drop cumulwgt
}
local m = 1
local n = `n' + 1
}

Comment