pingguzh 发表于 2015-7-14 09:52 
ywh19860616,其实我想做的就是不要把这么多变量一个一个列出来
因为变量名有规则,所以享用循环的方法写出 ...
clear
set obs 200
forv i = 1/20 {
gen x1_`i' = uniform()
}
local pre x1_1
forv i = 2/20 {
local pre `"`pre' x1_`i'"'
}
di `"`pre'"'
foreach x of local pre {
replace `x' = `x'*6
}