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

Re: st: mata: evaluating strings and functions as arguments?


From   Matissa Hollister <[email protected]>
To   [email protected]
Subject   Re: st: mata: evaluating strings and functions as arguments?
Date   Tue, 27 Dec 2005 15:42:57 -0800 (PST)

I think I figured out the answer to question #2.  I
need to use a pointer as described in pages 133-134 in
the mata manual.

I'd still be curious about the answer to #1, though.

Thanks

--- Matissa Hollister <[email protected]> wrote:

> I have two quick questions about using mata:
> 1) is there a way to get mata to evaluate the
> content
> of a string scalar, e.g.:
> 
> if I type:
> b="4+5"
> 
> then I later type:
> b
> it returns
> 4+5
> 
> is there a way that I can get it to evaluate b, i.e.
> return 9?
> 
> 2) Is there an easy way to have a function be an
> argument for another function?  Basically, I'd like
> to
> define a function that allows for different methods
> for calculating a value, so I'd like to be able to
> specify as an argument for the function which
> calculation function to use.  I could enter the
> calculation function name as a string, and then
> concatenate the arguments to the string.  Then I get
> back to problem 1), how to get mata to execute the
> concatenated string.
> 
> Thanks for the help.  I'm a very rudimentary stata
> programmer so I apologize if I'm missing something
> obvious.
> 
> MNH
> 
> 
> 	
> 		
> __________________________________ 
> Yahoo! for Good - Make a difference this year. 
> http://brand.yahoo.com/cybergivingweek2005/
> *
> *   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/
> 



	
		
__________________________________ 
Yahoo! for Good - Make a difference this year. 
http://brand.yahoo.com/cybergivingweek2005/
*
*   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