Monday, January 31, 2011

STATA: Open partial files

A handy trick which works for any situation in which you can't open a file because it's too big for memory (or you just want massive files to load faster to get a sense of what the data's like before you begin analysis in earnest). You can combine -use- with an if or in statement, as in:

use hugefile.dta in 1/50000, clear

or

use hugefile.dta if sex == 1, clear

2 comments:

  1. Thanks! This is exactly what I was looking for. Your blog is a great resource especially for late-comers to Stata like myself, who don't have the leisure from work to get any training

    ReplyDelete