I'm not quite sure of the problem itself, but you could try loading some of the data and analyzing it in parts like:
use in 1/20000 using "yourdata.dta", clear
If you want to analize it sistematically or have some condition like "keep certain observations", you could do something like:
local j = 1000000
local h = 1
forvalues i = 1(1000000)total_observations_in_your_data - 1000000{
use in `i'/`j' using "yourdata.dta", clear
keep if condition==1
tempfile myfile`h'
save `myfile`h''
local j = `j' + 1000000
local h = `h'+1
}
local k = `h'-1
use `myfile1'
forval r = 2(1)`k'{
append using `myfile`r''
}
save "yourdata_aux.dta", replace
In this case i'm using 1000000 observations per time, if you want something different, you have to change every"1000000" and the "total_observations_in_your_data"