Danielle <[email protected]> wrote,
> Suppose I have a columnvector in Mata. I know I can use -st_addvar- to add a
> variable to the Stata dataset. But how do I fill in the values of that
> variable with the values of the Mata columnvector? (By now, I have pored
> through the manual, and I canno t find a reference to this!) Thanks,
> Danielle
You use -st_store()- and I apologize that, in the Also See in
[M-5] st_addvar(), that was not mentioned.
Let's use the auto data,
. sysuse auto, clear
The auto data has 74 observations, so let's create a 74 x 1 vector and
then use -st_addvar()- to create new variable -example- in the Stata
dataset:
. mata
: x = J(74, 1, 2)
: st_addvar("float", "example")
13
: st_store(., "example", x)
: end
. describe
<output shows now variable example>
. list
<output shows new variable example contains 2 in every observation>
-- 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/