Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: saving and loading matrices


From   Roger Newson <roger.newson@kcl.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: saving and loading matrices
Date   Mon, 16 Aug 2004 10:14:41 +0100

At 17:21 15/08/2004, Oleksandr Shepotylo. wrote:
Hi ,

Is there a way to save and load matrices in text format?
Suppose I run Stata and want to use matrix A in another program X.
So, I want to save A in csv or txt form. Then I do some manipulations with A and want to load A back in Stata while keeping all my data unchanged.
To save a matrix to a text file, se -svmat- to copy a matrix to a dataset in memory, and -outsheet- to write that dataset to a disk file. To load a matrix from a text file, use -insheet- to read from the text file into a dataset in memory, and -mkmat- to copy the dataset into a matrix. To find more about -insheet- and -outsheet-, see -[R] insheet- and -[R] outsheet-. To find more about -mkmat- and -svmat-, see the Programming manual under -[P] matrix mkmat-.

I hope this helps.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: roger.newson@kcl.ac.uk
Website: http://www.kcl-phs.org.uk/rogernewson

Opinions expressed are those of the author, not the institution.

*
* 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/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index