user371651
user371651

Reputation: 1

Stata error 1001 Dataset contains more than 2 gigaobs (billion observations)

For an assignment I am required to download a dta file and answer some questions on a do file. However, when I type the command "use" on Stata and select the dta file, I get the response: too many observations {p 4 4 2} Dataset contains more than 2 gigaobs (billion observations). r(1001);

Is there a way to overcome the problem?

Upvotes: 0

Views: 75

Answers (1)

Ignacio2424
Ignacio2424

Reputation: 166

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"

Upvotes: 1

Related Questions