Bookmark and Share

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

[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 <>
To   "" <>
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 {
    replace result = S1 in `i'

would do it.


Kit Baum   |   Boston College Economics & DIW Berlin   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

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