Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: 3200 conformability error when writing to stata variable from mata


From   Aaron Kirkman <[email protected]>
To   [email protected]
Subject   st: 3200 conformability error when writing to stata variable from mata
Date   Thu, 13 Sep 2012 23:38:25 -0500

I have a simple piece of code that replicates a -generate- statement
(as an example) to write a new variable to an existing dataset. Under
certain circumstances, however, the code throws a runtime error:

 st_store():  3200  conformability error
                 <istmt>:     -  function returned error


This is the code that returns an error:
##

sysuse auto, clear
mata
mata clear
pmg = 1 :: 20
st_addvar("long","pmg")
st_store(.,"pmg",pmg)
end

##

The following code, however, is successful (I removed the views from
the last example because they are not relevant):

##

sysuse auto, clear
mata
mata clear
st_view(mpg=0,.,"mpg")
st_view(weight=0,.,"weight")
pmg=weight:*mpg
st_addvar("long","pmg")
st_store(.,"pmg",pmg)
end

##

As far as I can tell, the matrix -pmg- is of the same form in each
example, although it differs in the number of observations. Both are
column vectors containing only integers, so I'm not sure what is
causing the problem. What is causing the error in the first example?

Thank you,
Aaron Kirkman
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index