Hello everyone,

I have a big .dat file that makes my laptop freeze every single time that I try to open it. Since I am not going to use all variables in the dataset for my analysis, are there any ways to pre-select the desired variables? Here is my thinking. Assume that I want to pre-select variables x, y, and z; and the .dat file name is: Big_dataset
Code:
local vartokeep x y z
use "Big_dataset"
    if ("`varstokeep'"!="") {
        local tokeep                                 // empty to keep list
        foreach var of local varstokeep {            // loop over all selected variables
            capture confirm variable `var'           // check whether variable exists in current wave
            if (!_rc) local tokeep `tokeep' `var'    // mark for inclusion if variable exists
            }
        keep   `tokeep' // keep selected variables
        }
I am on the right track? Is there any quicker way?

Thank you for your help.