Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: 3200 conformability error when writing to stata variable from mata |
Date | Fri, 14 Sep 2012 06:00:44 +0100 |
It might be suggested that a reasonable default would be that Mata put this vector in the first 20 observations. Or again, into the last 20 observations. However, defaults such as those are not part of the Mata- Stata game. You need to be explicit about which observations are to receive the values in this vector.
NickOn 14 Sep 2012, at 05:38, Aaron Kirkman <ak1795mailserv@gmail.com> wrote:
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
* * 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/