Statalist The Stata Listserver


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

st: RE: Using scalars when defining matrices


From   "Rodrigo Martell" <[email protected]>
To   <[email protected]>
Subject   st: RE: Using scalars when defining matrices
Date   Fri, 8 Dec 2006 11:53:27 +1100

Others on the list might give a more correct and/or efficient answer, but this seems to work:

Run this through a do-file since `b3' seems to try to call a macro:

local b3=2
matrix input Matrixnew=(1,`b3',`b3',`b3'\ `b3',1,0,0\ `b3',0,1,0\ `b3',0,0,1)
matrix list Matrixnew


Cheers,

Rodrigo

Rodrigo Martell

 <http://www.frontier-economics.com> 	
Frontier Economics Pty. Ltd.
395 Collins Street
Melbourne VIC 3000
Australia
www.frontier-economics.com 	
switch:
direct:
fax:
mobile:
email:


+61 (0)3 9620 4488
+61 (0)3 9613 1518
+61 (0)3 8614 2711
+61 (0)407 909 811
[email protected] <mailto:[email protected]> 


This e-mail, including any attachments, may contain confidential and privileged information for the sole use of the intended recipient(s). Any review, use, disclosure or distribution by others is strictly prohibited. If you are not the intended recipient (or authorised to receive information for the recipient), please contact the sender by reply e-mail and delete all copies of this message. Thank you.

	



-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Rachel
Sent: Friday, 8 December 2006 11:49 AM
To: statalist
Subject: st: Using scalars when defining matrices


I'm having trouble with the syntax of matrix define (or input) when
using scalars.  When I try the following:

scalar b3=2
matrix input Matrixnew=(1,`b3',`b3',`b3'\ `b3',1,0,0\ `b3',0,1,0\ `b3',0,0,1)

I get a syntax error even though I've put a space in between the
slashes and the scalars (per the manual) to avoid confusion.  What am
I doing wrong?

Thanks,
Rachel
*
*   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/

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index