I am really struggling with this coding. I am sorry to post repeatedly. I am trying to write the following:
I need help to create local equation lists automatically so that it gives me from equation2 to equation`k'.
Thanks a lot.
Sincerely,
Rabiul
HTML Code:
clear all program define svywt version 15.1 syntax varlist, WTvar(varlist) gettoken depvar indepvars : varlist _fv_check_depvar `depvar' local k: word count `wtvar' local eqn1(1:`:word 1 of `wtvar''/(1+{xb: `wtvar'})) forvalues i = 2/`k'{ local eqn`i'(eqn`i':`:word `i' of `wtvar''/(1+{xb: })) local eqlist `eqn2' `eqn3'`eqn`k'' //I NEED HELP HERE to make this equation list like local eqlist from `eqn2' to `eqn`k'' } local last(last:(`depvar' - ({`depvar': `indepvars' _cons}))/ (1+{xb: })) local last_inst instruments(last: `indepvars') gmm `eqn1' `eqlist' `last', `last_inst' onestep winitial(unadjusted, independent) end sysuse auto, clear egen y = mean(price) gen price_1 = price -y egen x = mean(mpg) gen mpg_1=mpg-x egen z =mean(trunk) gen trunk_1 = trunk-z egen d = mean(weight) gen weight_1 =weight-d svywt price weight mpg, wtvar(price_1 mpg_1 trunk_1 weight_1)
Thanks a lot.
Sincerely,
Rabiul
Comment