Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: problems with global macros in mata


From   "Benjamin Klaus" <[email protected]>
To   [email protected]
Subject   st: problems with global macros in mata
Date   Mon, 28 Jul 2008 17:33:18 +0200

I want to export the (changing) content of a matrix "x" from mata into textfiles named "mi.txt", where "i" is a global macro. This should work in the following way, but it seems that the value of the global macro is not changed correctly at each stage of the loop...

+++++++++++++++++++++++++++++++++++++++++++++++

mata
	x = (76, 53, 48 \ 53, 88, 46 \ 48, 46, 63)
	i=0
	while (i<=5) {
	
		i = i + 1
		st_global("i",strofreal(i))
		stata("display($i)")	// just to check the value (it doesn't work)
		mm_outsheet("D:\m$i.txt", strofreal(x), "replace")
	
	}
end

+++++++++++++++++++++++++++++++++++++++++++++++

Thank you in advance,
Benjamin
-- 
Psssst! Schon vom neuen GMX MultiMessenger geh�rt?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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