Raphael Fraser <[email protected]> wrote,
> Can anyone explain why the matrix X gives the incorrect result?
> [...]
> At some point the matrix F becomes A. What's the problem?
and Jeper Hansen <[email protected]> replied,
> A view is what is says: a view.
>
> When you -insheet- data the second time, F is updated, and you get F
> == A. Is this the "problem" you are refering to? Maybe in this case
> you need -st_data()- instead of -st_view()?
Exactly right. I would just like to add to that how Raphael can
obtain the desire he wants: use -st_data()- rather than -st_view()-
to create the first matrix. Change the line that read
st_view(F=., ., .)
to read
F = st_data(., .)
so that the code becomes
mata clear
stata("insheet using freq.csv, clear")
stata("drop subjectid")
F = st_data(., .) // <- changed
stata("insheet using amt.csv, clear")
stata("drop subjectid")
st_view(A=., ., .)
X = 0.01*(A:*F)
st_data() makes a copy of the data in F. st_view() makes F into a
view onto the data currently in memory.
-- Bill
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/