Hi,
I just tried to generate generic mock data as fast as possible with my up-to-date Stata 13.1 MP for the mac. I though the fastest (though irreproducible) way would be to declare vars and let Stata use whatever values it finds at its allocation in RAM. Instead, when I used -st_addvar()- with the nofill option, I generated variables filled with zeros (instead of . when nofill=0). Why is this option useful, then? Or is this OS-specific, and the mac (OS 10.10) is careful enough to erase RAM before it gives it to Stata? Or Stata erases it before Mata (re)uses it? Or did I just get unlucky to be allocated a blank part of RAM?
Yes, setting up a view after -st_addvar- and using -runiform- for all variables at once is not prohibitive, but still slower.
Otherwise the fastest way to generate 19 random variables for 100000 observations in Stata (I know of) is:
I just tried to generate generic mock data as fast as possible with my up-to-date Stata 13.1 MP for the mac. I though the fastest (though irreproducible) way would be to declare vars and let Stata use whatever values it finds at its allocation in RAM. Instead, when I used -st_addvar()- with the nofill option, I generated variables filled with zeros (instead of . when nofill=0). Why is this option useful, then? Or is this OS-specific, and the mac (OS 10.10) is careful enough to erase RAM before it gives it to Stata? Or Stata erases it before Mata (re)uses it? Or did I just get unlucky to be allocated a blank part of RAM?
Yes, setting up a view after -st_addvar- and using -runiform- for all variables at once is not prohibitive, but still slower.
Otherwise the fastest way to generate 19 random variables for 100000 observations in Stata (I know of) is:
Code:
clear all set obs 100000000 mata: idx = st_addvar("double",("x1","x2","x3","x4","x5","x6","x7","x8","x9","x10","x11","x12","x13","x14","x15","x16","x17","x18","x19"),1) V = J(0,0,.) st_view(V,.,idx) V[.,.] = runiform(100000000,19) end
Comment