Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <ak1795mailserv@gmail.com>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index