I was writing a moment evaluator GMM program with a special purpose. However, complying with the convention, I could not reach my goal. It shows that "no non-missing values returned for equation 1 at initial values". I appreciate your kind help and suggestions. My codes are copied below:
HTML Code:
clear all
 
program mom_cond
    version 15.1
    syntax [varlist] [if] [in], at(name) WTvar(varlist) MOMents(numlist)
    
    local i 0
    foreach var of local wtvar{
        local ++i
        tempvar W_`i'
        gen double `W_`i'' = (`var' - `:word `i' of `moments'') `if'
        local weightlist "`weightlist' `W_`i''"
    }
    
    local k: word count varlist:`wtvar'
    
    local j=1
    foreach v of local weightlist{
            tempvar m_`j'
            qui gen double `m_`j'' = 0 `if'
            forvalues i=1/`k'{
            qui replace `m_`j'' = `m_`j'' + `v'*`at'[1, `i'] `if'
            }
            local `++j'
    }
        
    
    forvalues i= 1/`k'{
                local eq`i' `: word `i' of `wtvar''
                qui replace `eq`i'' = `W_`i'' /(1+exp(`m_`i'')) `if'
            }        
end

sysuse auto, clear
gmm mom_cond, wtvar(price mpg weight) mom(6000 22 3000) nequations(3) nparameters(3) winitial(unadjusted, independent) onestep
Note: In my program, the number of equations will be equal to the number of variables in local wtvar (since I do not have any intercept).

Thank you in advance.

Rabiul