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]
Re: st: Problems with mata:st_view and syntax
From
daniel klein <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Problems with mata:st_view and syntax
Date
Sun, 21 Jul 2013 12:26:08 +0200
We discussed the behavior of view matrices about two moth ago starting
here: http://www.stata.com/statalist/archive/2013-05/msg00893.html
You can savely irnogre my contibution to that discussion as it turns
out most of it is merely wrong and none of it helps you with the
problem. I do not believe Sergiy found a "solution" other than keeping
this behavior in mind and set up new matices whenever you change the
underlying dataset. So I guess the answer to your question is: no, you
cannot avoid this behavior.
Best
Daniel
--
The first one is about mata:st_view. Consider the following STATA code:
--------------------------------------------------------------------------
clear
clear mata
set obs 5
gen a=1
gen b=2
gen c=3
mata: st_view(X=., ., "a c")
mata: X /* ---> Correctly shows column a and c */
drop b
mata: X /* ---> Showing column a and empty column! */
---------------------------------------------------------------------------
I expect the sub_view X wouldn’t change (still a and c) after I
dropped column b.
However, somehow dropping b would affect the sub_view X.
Is there a way to avoid this behaviour?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/