Hi,
Im trying to keep a certain set of observarions from my dataset.
I want to keep observations that have any of a defined set of values in any of a subset of variables.
To be specific, each of my variables is a moment in an occupational trayectory (first job, second job, third job, etc..) and i would like to keep observations that at any point in their trayectory have had any of certain jobs (eg: accountant, doctor, manager, teacher, etc). So i would want to keep observations that at any point have had any of those jobs.
I could do this manually with a very long keep command (i have 11 variables and 141 jobs i want to keep) but i get an "expression too long" error.
(the actual code is 1800 lines long)
Code:
keep if job1 == 1120 /// | job1 == 1200 /// | job1 == 1210 /// | job2 == 1120 /// | job2 == 1200 /// | job2 == 1210 /// | job3 == 1120
Is there a simpler way to do this ? Can i use lists or macros for this? (i have never used them, but i would like to learn)
Thanks in advanced
Comment