I am struggling with defining a function that will accept a Stata macro and then tokenize that macro into two elements. I have tried the following but did not succeed. The following code is just an example, I am trying to learn how one can transfer contents of a local macro to Mata function.
Code:
local anything "2 6" mata function fasm (string scalar anything) { t = tokeninitstata() tokenset(t, st_local("anything")) formation = tokenget(t) testing = tokenget(t) st_global(FRM, formation) st_global(TST, testing) } end . mata: fasm("`anything'") st_global(): 3254 nonstring found where string required fasm(): - function returned error <istmt>: - function returned error r(3254);
Comment