Hello, I am using the IHDS dataset to construct a quantile graph like the one shown in the image. Following is the code I am running:
Stata returns me an error saying 'something missing'
Any help on what I am doing wrong here is greatly appreciated.
Thanks,
Kusha

Code:
gen inc_fem = incph if sex == 0 gen loginc_fem = log(inc_fem) gen inc_male = incph if sex == 1 gen loginc_male = log(inc_male) pctile qinc = logincph, nq(100) genp(percent) pctile qincf = loginc_fem, nquantiles(100) genp(percent1) pctile qincm = loginc_male, nquantiles(100) genp(percent2) gen log_gap = (qincm - qincf)/qincf forvalues q=10/90{ quiet qreg logincph i.edu sex age public married religion i.caste i.state i.industry i.occupation, q(`q') mat qr1=nullmat(qr1)\_b[sex] mat quantile=nullmat(quantile)\\`q' } svmat quantile svmat qr1 quiet reg logincph sex i.edu age public married religion i.caste i.state i.industry i.occupation if sex == 1 local ols1 = _b[sex] quiet reg logincph sex i.edu age public married religion i.caste i.state i.industry i.occupation if sex == 0 local ols0 = _b[sex] twoway (line qr11 quantile1, lcolor(red)), yline(`ols1', lcolor(red)) yline(`ols0', lcolor(black)) yline('log_gap', lcolor(green))
Any help on what I am doing wrong here is greatly appreciated.
Thanks,
Kusha
Comment