Hi all,
I am writting an ado file where I would like to use mata as well. I am having some difficulty parsing the options from my program into mata. Here is a simplified version of my problem
Ideally, I would like to parse deriv and x into mata, but I am having some trouble with them. Can someone help me out here? The correct solution should be 21.2973 + 1 + 1.
I am writting an ado file where I would like to use mata as well. I am having some difficulty parsing the options from my program into mata. Here is a simplified version of my problem
Code:
program define addition syntax varlist(max=1), deriv(real) x(real) mata : m_add("`varlist'", "`deriv'","`x'","`b'") display "b is" mmatrix list `b' end mata: void m_add(string scalar vname, string scalar deriv, string scalar x, string scalar mname) { real vector x real scalar w height de x = st_data(.,vname) height = st_local(.,h) de = st_local(.,deriv) w = mean(data) + height + de st_matrix(mname,w) } end sysuse auto, clear addition mpg, deriv(1) x(1)
Comment