Dear Statalists,
I need your help. First of all, I am quite new to this and still trying to figure out the basic functions, so excuse me for asking "dumb" questions.
In order to create a panel data set out of several annual survey, I am currently trying to get rid of many variables I do not need. For my purposes, the "keep"-command seemed easier than "drop". Therefore I wrote a do-file:
use XYZ.dta
keep A B C D E F
Unfortunately, not every variable is existent in every survey. As a result, I received the error "variable D not found". Can I somehow execute the keep command despite not having the variable in my dataset? Capture keep did not work (the other variables are not being dropped).
Thanks for your help!
I need your help. First of all, I am quite new to this and still trying to figure out the basic functions, so excuse me for asking "dumb" questions.
In order to create a panel data set out of several annual survey, I am currently trying to get rid of many variables I do not need. For my purposes, the "keep"-command seemed easier than "drop". Therefore I wrote a do-file:
use XYZ.dta
keep A B C D E F
Unfortunately, not every variable is existent in every survey. As a result, I received the error "variable D not found". Can I somehow execute the keep command despite not having the variable in my dataset? Capture keep did not work (the other variables are not being dropped).
Thanks for your help!
Comment