Statalist The Stata Listserver


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

Re: st: Using scalars when defining matrices


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Using scalars when defining matrices
Date   Fri, 08 Dec 2006 10:42:36 -0500

If you use tempnames, then you don't need to use the scalar() function because the name will be unique and you should only place single quotes around macro names (like beta, which is created by tempname).

Also, you should drop the "input" and you need to put a space after the \ to prevent a problem with macro expansion (the \ prevents macro expansion)

matrix `BigMat'=(1,`beta' \ `beta',`beta')

should work.


Michael Blasnik

----- Original Message ----- From: "Rachel" <[email protected]>
To: <[email protected]>
Sent: Friday, December 08, 2006 10:17 AM
Subject: Re: st: Using scalars when defining matrices


<snip>

1:arg {other vars} abc
2: tempname beta BigMat
3 scalar `beta'=exp(`abc')
4 matrix input `BigMat'=(1,`scalar(beta)'\`scalar(beta)',`scalar(beta)')
*
*   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