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

st: gen variables that equals to local


From   "Ada Ma" <[email protected]>
To   <[email protected]>
Subject   st: gen variables that equals to local
Date   Sat, 18 Jan 2003 21:21:27 -0000

Hello Statalist,

Thanks for the help offered earlier.  I have yet another problem.  This time
I'm writing a program that loops through 99 files and then merge them all
together in the end.  I want to create a varible that equals to the value of
the local variable, so that I can tell which file the observation originally
comes from.

e.g. I have:

local i=1989
while i<2000 {
use `i'
gen year=`i'
save `i', replace
clear
}

TIA!

Ada Ma
Department of Economics
University of Aberdeen, Scotland
[email protected]
*
*   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