Hi, all. I'm working on my first piece of Mata code, which involves modifying the -codebookout- command so that it outputs variable characteristics as well as labels, etc. I'm having a rough time debugging the portion of the Mata script that accesses the variable characteristic (which I call "desc"), and I'm hoping someone can help.
The trouble spot is here:
I receive the following message:
mata_codebookout(): 3200 conformability error
<istmt>: - function returned error
Thanks in advance for any help you can offer.
Code:
clear mata mata: function mata_codebookout(){ nv=st_nvar() A=J(0,6,"") for(i=1; i<=nv; i++ ){ if(st_varvaluelabel(i)!=""){ a1=st_varname(i),st_varlabel(i),st_vartype(i), st_local(i[desc]) st_vlload(st_varvaluelabel(i), values=., text=.) a2=(strofreal(values),text) a2_2="","" a2=a2_2\a2 dum=length(a2[.,1])-1 a1_2=J(dum,3,"") a1=a1\a1_2 a=a1,a2 A=A\a } else{ b=st_varname(i),st_varlabel(i),st_vartype(i),"","Open ended" A=A\b } } return(A) } end
Code:
a1=st_varname(i),st_varlabel(i),st_vartype(i), st_local(i[desc])
mata_codebookout(): 3200 conformability error
<istmt>: - function returned error
Thanks in advance for any help you can offer.
Comment