Filtering based on separate dataset values

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

FernaldSPSS
Posts: 1
Joined: Thu May 19, 2016 4:52 pm
Location: United States

Filtering based on separate dataset values

Postby FernaldSPSS » Thu May 19, 2016 6:02 pm

I'm new to the forum, returning to SPSS after a long absence. I need help working with data from two independent datasets. Our survey system produces SPSS-ready datasets and syntax, so it's easy to set up analysis. Here is my data set up:

- Dataset 1 has all the clinic data I want to analyze, including multiple observations for the same clinics. It’s updated continuously.
- Dataset 2 has a list of clinics that have dropped out. It’s updated monthly.

Dataset 1 and Dataset 2 share the same ID numbers for the same clinics. All the other variables are different.

I want to run analysis on Dataset 1 periodically. I also want to make sure that I filter out all clinic observations whose ID matches an ID in Dataset 2. I will download the latest datasets for both when I want to re-run the analysis.

Is there a way to set up syntax that I can re-run to filter out any clinics that appear in Dataset 2? I’d like to avoid having to manually add new IDs to a filter. Here's an example of how data look and what I'd like see in a filtered dataset:

DATASET 1
ID v1 v2
1 A 50
1 A 55
2 B 56
2 B 55
3 A 70
4 A 73
5 B 66
5 B 54
6 A 55
7 B 68
8 A 78
8 A 76

DATASET 2
ID Dropout1
2 Yes
4 Yes
7 Yes

FILTERED DATASET 1 (remove all observations for ID 2, 4 or 7)
ID v1 v2
1 A 50
1 A 55
3 A 70
5 B 66
5 B 54
6 A 55
8 A 78
8 A 76

Any help would be greatly appreciated.

Who is online

Users browsing this forum: No registered users and 0 guests

cron