Reputation: 55
I am working with a large dataset on SPSS. I have certain inclusion and exclusion criteria for a research project, but I am unsure how to filter the data by complex conditions.
For example, I want to include cases that satisfy specific criteria:
Inclusion: Had surgery, cancer was in the oropharynx, cancer was in the oral cavity
Exclude: has metastatic disease, no biopsy done, has missing data on survival and margin status.
The variables given to me are complicated. For example the variable for the primary site of cancer is a list of strings which describe different parts on the body. I would have to recode this into being oropharynx or oral cavity and then I only want cases with either of those sites.
What is the best systematic approach using syntax? Should I use Do IF, IF ELSE statements? or filter by?
Im not sure how to filter by all of these conditions in the syntax editor
Upvotes: 1
Views: 4426
Reputation: 11310
Best to calculate a new variable with all the conditions, then use it to filter.
In the following example, variable filt
will receive value 1 for cases that have all the conditions, and 0 for those that don't:
compute filt=
(varA="this" or varA="that") and
not missing(varB) and
(varC>=10 and varC<=20).
filter by filt.
If you don't need the other cases later, instead of filter
you can use:
select if filt=1.
Upvotes: 1