Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: Re: How to perform calculations on a set of tempvars


From   francesco manaresi <[email protected]>
To   [email protected]
Subject   Re: st: RE: Re: How to perform calculations on a set of tempvars
Date   Sun, 26 Sep 2010 15:53:08 +0200

Thank you, your answer (and the reference) was pretty useful.
I ended up creating variables, however, since most of the "rowwise"
functions do not seem to work properly with macros.
Thanks again,
f







On Sat, Sep 25, 2010 at 11:00 AM, Martin Weiss <[email protected]> wrote:
>
> <>
>
> The -min()- function does not take a -varlist-, but a comma-separated list
> of arguments, hence the error. Try -egen, rowmin()- instead:
> http://www.stata-journal.com/article.html?article=pr0046
>
>
>
> HTH
> Martin
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of francesco
> manaresi
> Sent: Samstag, 25. September 2010 09:02
> To: [email protected]
> Subject: st: Re: How to perform calculations on a set of tempvars
>
> I created sets of tempvars of the type
> var_`i'_`x'
> containing the result of a statistic (say, a p-value) calculated for
> variable `x' in State `i'
>
> I would like to perform calculations and have the result in another
> macro. For instance, I want the minimum of all the p-values by State.
> However, Stata does not accept the following syntax:
>
> tempvar minimum
> g `minimum' = min(`var_`i'_*')
>
> invalid syntax
> r(198);
>
> I believe this is because Stata doesn't accept asterisks (jolly
> character) within macronames.
> Am I right? What can I do alternatively, apart from creating hundreds
> of real variables?
> *
> *   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/
>
> *
> *   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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index