I am trying to decipher the manuals for mata to do something that I
imagine is pretty simple, returning my results from mata to (ideally)
matching observations for my starting data in Stata. I basically use
the st_data command to move my stata based observations into a mata
matrix as follows:
I = st_data(., "var 1", "var2", etc.)
I now have a mata based matrix, I, that has all of my data including
identification data such as company number and trading day.
I next use the information variables to produce some new values and
let us assume I create a new matrix in mata called results that has
the following form
Results = (Company Number, Trade Day, Result 1, Result 2, etc.)
where the rows are different observations.
Back in Stata I have variables such as
Company Number, Trade Day, Input Data1, Input Data 2, etc.
My goal is to append the mata based information into new stata
variables with matching observations that would appear as follows:
Company Number, Trade Day, Input Data 1, ...Input Data n, Result 1,
...Result n, etc.
I have struggled in vain to decipher the mata manual for commands such
as creating new stata variables from mata (st_addvar), adding
observations (st_addobs), and modifying or moving values (st_store)
but have had zero luck in getting anything to work. At this point I
am thinking I may simply need to write an output file from mata, close
mata and insheet the output file into stata to append to the dataset
there.
Can anyone provide any thoughts or suggestions on how to proceed?
With great thanks,
Tom
--
Thomas Jacobs
*
* 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/