See SORT and MATCH FILES!
---
data list free /sched_id data1.
begin data
1 2 2 3 5 6 12 5 7 7
end data.
sort cases by sched_id.
save outfile 'keepers.sav' .
data list free /sched_id data2.
begin data
1 2 2 3 9 6 3 6 4 5 5 7 6 3 7 4 8 5 11 8 12 9 10 7
end data.
sort cases by sched_id.
save outfile 'file1.sav' .
match files / file 'keepers.sav' / table 'file1.sav' / by sched_id.
list.
SCHED_ID DATA1 DATA2
1.00 2.00 2.00
2.00 3.00 3.00
5.00 6.00 7.00
7.00 7.00 4.00
12.00 5.00 9.00
Number of cases read: 5 Number of cases listed: 5
Manoj Soni wrote
In Spss, when selecting cases, there are ways to select the data.
My query is , if I have two data files contains 2700 cases and another file
contains 1200 cases. In both the files, One ScheduleID is common field. Now
based on the ScheduleID in 1200 cases file, I want same no. of ScheduleID
cases in File 1 and rest of them automatically deleted by a program or
logic.
Example
File 1
ScheduleID C1 C2
1
2
3
-
-
-
-2700
Total 2700 cases
File 2. ScheduleID B1 B2
5
7
8
9
10
15
-
-
2680
Total 1200 cases
How to remove those cases in file 1 those are not in file 2 based on
ScheduleID.
Thanks in advance.
Regards
Manoj
India.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"