prog birth,rclass
drop _all
tempvar y
forvalues j=20/40{
set obs `j'
gen `y'=10*int(365*uniform())
scalar z`j'=0
sort `y'
forvalues i=1/`1'{
if `y'[`i']==`y'[`i'+1]{
return scalar z`j'=1
continue, break
}
}
}
}
end
simulate z, reps(100): birth
就是这个程序,本来是单个数据模拟的,怎样才能变成循环数据模拟的呢??直接在子程序里调用么??