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: How to insert scalars (elements from Stata's matricies) as locals' values in the 'forvalues' command?


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: How to insert scalars (elements from Stata's matricies) as locals' values in the 'forvalues' command?
Date   Fri, 19 Oct 2012 09:34:17 +0200

On Fri, Oct 19, 2012 at 9:19 AM, Charalambos Karagiannakis wrote:
> sum time_quarter
> forvalues i = [r(min)](1)[r(max)] {

The way to make that work is:

forvalues i = `r(min)'(1)`r(max)' {

or:

forvalues i = `r(min)/`r(max)' {

However, I suspect that you are much better of not running that loop
at all and instead look at the -by- prefix in combination with -egen-.

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index