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 'append' scalars and convert to a variable


From   Christopher Baum <[email protected]>
To   "[email protected]" <[email protected]>
Subject   re: st: how to 'append' scalars and convert to a variable
Date   Sun, 1 Jan 2012 11:06:29 -0500

<>
Steve said

I use -forvalues- to apply a block of code 100 times.  Each loop concludes
with the generation of a scalar called S1.  This contains a number.  

Is it possible to 'append' the values in these numeric scalars to form a
variable with 100 observations?

Presuming you have more than 100 obs. in memory I don't see why you would need to use post.

g result = .
forvalues i=1/100 {
    whatever…
    replace result = S1 in `i'
}

would do it.

Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html




*
*   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