matching and merging

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

matching and merging

Raffe, Sydelle, SSA

I have two data files I’m trying to fuse together. But, I’m in a paper bag and can’t find my way out. I have tried to break the task down to simplify it but that’s not working for me. Well, anything I’ve tried hasn’t been working. Below I describe the two files and provide a picture of the desired resulting file. Thank you as always.

 

transaction file

Many transactions to each case.

 

 

 

 

 

 

 

 

 

Not all cases belong, only those in the case file (below).

 

 

 

 

 

 

 

 

 

Keep all variables.

 

 

 

 

 

 

 

 

 

Add variables from the case file (below)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

case_id

 

 

 

 

 

 

 

 

 

6671

FS 

1111

10.61

10/19/2011 13:35

283.52

RICHMOND   

CA

 

6671

FS 

1111

8.98

10/23/2011 20:08

274.54

RICHMOND   

CA

 

6671

FS 

1111

9.42

10/24/2011 20:27

265.12

RICHMOND   

CA

 

6671

FS 

1111

6.74

10/27/2011 12:10

258.38

RICHMOND   

CA

 

8782

FS 

1111

8.79

8/7/2011 23:44

191.21

PLEASANT HIL

CA

 

8782

FS 

1111

151.31

8/8/2011 19:15

39.9

CONCORD    

CA

 

8782

FS 

1111

6.07

8/8/2011 21:15

33.83

WALNUT CREEK

CA

 

8782

FS 

1111

33.83

8/16/2011 18:52

0

CONCORD    

CA

 

8782

FS 

1111

189.46

9/7/2011 17:53

10.54

CONCORD    

CA

 

8782

FS 

1111

201.32

10/7/2011 13:48

9.22

CONCORD    

CA

 

8782

FS 

1111

2

10/23/2011 23:11

7.22

WALNUT CREEK

CA

 

8782

FS 

1111

7.22

10/26/2011 18:51

0

WALNUT CREEK

CA

 

8530

FS 

1111

6.81

8/10/2011 15:58

193.32

PACIFICA   

CA

 

8530

FS 

1111

3.52

8/10/2011 17:09

189.8

PACIFICA   

CA

 

8530

FS 

1111

2.22

8/10/2011 19:39

187.58

PACIFICA   

CA

 

8530

FS 

1111

62.39

8/10/2011 20:11

125.19

PACIFICA   

CA

 

8530

FS 

1111

13.56

8/13/2011 23:54

111.63

PACIFICA   

CA

 

8530

FS 

1111

22.78

8/14/2011 16:37

88.85

PACIFICA   

CA

 

 

 

 

 

 

 

 

 

 

 

 

 

case file

 

one record per case.

 

 

 

 

 

Variables from this file should be added to each record of the transaction file by case_id.

 

 

 

 

 

If case_id appears in this file, the case_id should appear in the transactions file.

 

 

 

 

 

 

 

 

 

case_id

addr1

city

state

zip

 

6671

 

 

 

 

 

8530

 

 

 

 

 

 

 

Desired Result File

 

case_id

 

 

 

 

 

 

 

 

 

addr1

etc

 

 

6671

FS 

85801

1111

10.61

10/19/2011 13:35

283.52

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

8.98

10/23/2011 20:08

274.54

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

9.42

10/24/2011 20:27

265.12

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

6.74

10/27/2011 12:10

258.38

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

8530

FS 

185704

1111

6.81

8/10/2011 15:58

193.32

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

3.52

8/10/2011 17:09

189.8

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

2.22

8/10/2011 19:39

187.58

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

62.39

8/10/2011 20:11

125.19

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

13.56

8/13/2011 23:54

111.63

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

22.78

8/14/2011 16:37

88.85

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

 

 

 

Sydelle Raffe

Management Analyst

Office of Data Management

Information Services Division

510-271-9174 (29174)

 

I'm not an outlier; I just haven't found my distribution yet! -- Ronan M. Conroy, Lecturer in Biostatistics, Royal College of Surgeons of Ireland

 

Reply | Threaded
Open this post in threaded view
|

Re: matching and merging

Hector Maletta

You have to treat your “case file” as a keyed table, so that the data for each “case” are copied into each transaction record in the “transaction file”.

 

SYNTAX (substitute the proper pathname for each file):

 

GET FILE ‘transaction file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘transaction file’.

 

GET FILE ‘case file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘case file’.

 

MATCH FILES / FILE = ‘transaction file’ / TABLE = ‘case file’ / BY case_id.

 

You can achieve the same via menu, of course.

 

Hector

 

 

De: SPSSX(r) Discussion [mailto:[hidden email]] En nombre de Raffe, Sydelle, SSA
Enviado el: Tuesday, April 10, 2012 20:19
Para: [hidden email]
Asunto: matching and merging

 

I have two data files I’m trying to fuse together. But, I’m in a paper bag and can’t find my way out. I have tried to break the task down to simplify it but that’s not working for me. Well, anything I’ve tried hasn’t been working. Below I describe the two files and provide a picture of the desired resulting file. Thank you as always.

 

transaction file

Many transactions to each case.

 

 

 

 

 

 

 

 

 

Not all cases belong, only those in the case file (below).

 

 

 

 

 

 

 

 

 

Keep all variables.

 

 

 

 

 

 

 

 

 

Add variables from the case file (below)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

case_id

 

 

 

 

 

 

 

 

 

6671

FS 

1111

10.61

10/19/2011 13:35

283.52

RICHMOND   

CA

 

6671

FS 

1111

8.98

10/23/2011 20:08

274.54

RICHMOND   

CA

 

6671

FS 

1111

9.42

10/24/2011 20:27

265.12

RICHMOND   

CA

 

6671

FS 

1111

6.74

10/27/2011 12:10

258.38

RICHMOND   

CA

 

8782

FS 

1111

8.79

8/7/2011 23:44

191.21

PLEASANT HIL

CA

 

8782

FS 

1111

151.31

8/8/2011 19:15

39.9

CONCORD    

CA

 

8782

FS 

1111

6.07

8/8/2011 21:15

33.83

WALNUT CREEK

CA

 

8782

FS 

1111

33.83

8/16/2011 18:52

0

CONCORD    

CA

 

8782

FS 

1111

189.46

9/7/2011 17:53

10.54

CONCORD    

CA

 

8782

FS 

1111

201.32

10/7/2011 13:48

9.22

CONCORD    

CA

 

8782

FS 

1111

2

10/23/2011 23:11

7.22

WALNUT CREEK

CA

 

8782

FS 

1111

7.22

10/26/2011 18:51

0

WALNUT CREEK

CA

 

8530

FS 

1111

6.81

8/10/2011 15:58

193.32

PACIFICA   

CA

 

8530

FS 

1111

3.52

8/10/2011 17:09

189.8

PACIFICA   

CA

 

8530

FS 

1111

2.22

8/10/2011 19:39

187.58

PACIFICA   

CA

 

8530

FS 

1111

62.39

8/10/2011 20:11

125.19

PACIFICA   

CA

 

8530

FS 

1111

13.56

8/13/2011 23:54

111.63

PACIFICA   

CA

 

8530

FS 

1111

22.78

8/14/2011 16:37

88.85

PACIFICA   

CA

 

 

 

 

 

 

 

 

 

 

 

 

 

case file

 

one record per case.

 

 

 

 

 

Variables from this file should be added to each record of the transaction file by case_id.

 

 

 

 

 

If case_id appears in this file, the case_id should appear in the transactions file.

 

 

 

 

 

 

 

 

 

case_id

addr1

city

state

zip

 

6671

 

 

 

 

 

8530

 

 

 

 

 

 

 

Desired Result File

 

case_id

 

 

 

 

 

 

 

 

 

addr1

etc

 

 

6671

FS 

85801

1111

10.61

10/19/2011 13:35

283.52

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

8.98

10/23/2011 20:08

274.54

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

9.42

10/24/2011 20:27

265.12

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

6.74

10/27/2011 12:10

258.38

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

8530

FS 

185704

1111

6.81

8/10/2011 15:58

193.32

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

3.52

8/10/2011 17:09

189.8

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

2.22

8/10/2011 19:39

187.58

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

62.39

8/10/2011 20:11

125.19

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

13.56

8/13/2011 23:54

111.63

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

22.78

8/14/2011 16:37

88.85

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

 

 

 

Sydelle Raffe

Management Analyst

Office of Data Management

Information Services Division

510-271-9174 (29174)

 

I'm not an outlier; I just haven't found my distribution yet! -- Ronan M. Conroy, Lecturer in Biostatistics, Royal College of Surgeons of Ireland

 

Reply | Threaded
Open this post in threaded view
|

Re: matching and merging

Raffe, Sydelle, SSA

Thank you. It runs perfectly creating all the variables in one file. Unfortunately, all the data are missing!  At least that’s a new outcome! I think I’ll try again tomorrow.

 


From: Hector Maletta [mailto:[hidden email]]
Sent: Tuesday, April 10, 2012 6:45 PM
To: Raffe, Sydelle, SSA; [hidden email]
Subject: RE: matching and merging

 

You have to treat your “case file” as a keyed table, so that the data for each “case” are copied into each transaction record in the “transaction file”.

 

SYNTAX (substitute the proper pathname for each file):

 

GET FILE ‘transaction file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘transaction file’.

 

GET FILE ‘case file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘case file’.

 

MATCH FILES / FILE = ‘transaction file’ / TABLE = ‘case file’ / BY case_id.

 

You can achieve the same via menu, of course.

 

Hector

 

 

De: SPSSX(r) Discussion [mailto:[hidden email]] En nombre de Raffe, Sydelle, SSA
Enviado el: Tuesday, April 10, 2012 20:19
Para: [hidden email]
Asunto: matching and merging

 

I have two data files I’m trying to fuse together. But, I’m in a paper bag and can’t find my way out. I have tried to break the task down to simplify it but that’s not working for me. Well, anything I’ve tried hasn’t been working. Below I describe the two files and provide a picture of the desired resulting file. Thank you as always.

 

transaction file

Many transactions to each case.

 

 

 

 

 

 

 

 

 

Not all cases belong, only those in the case file (below).

 

 

 

 

 

 

 

 

 

Keep all variables.

 

 

 

 

 

 

 

 

 

Add variables from the case file (below)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

case_id

 

 

 

 

 

 

 

 

 

6671

FS 

1111

10.61

10/19/2011 13:35

283.52

RICHMOND   

CA

 

6671

FS 

1111

8.98

10/23/2011 20:08

274.54

RICHMOND   

CA

 

6671

FS 

1111

9.42

10/24/2011 20:27

265.12

RICHMOND   

CA

 

6671

FS 

1111

6.74

10/27/2011 12:10

258.38

RICHMOND   

CA

 

8782

FS 

1111

8.79

8/7/2011 23:44

191.21

PLEASANT HIL

CA

 

8782

FS 

1111

151.31

8/8/2011 19:15

39.9

CONCORD    

CA

 

8782

FS 

1111

6.07

8/8/2011 21:15

33.83

WALNUT CREEK

CA

 

8782

FS 

1111

33.83

8/16/2011 18:52

0

CONCORD    

CA

 

8782

FS 

1111

189.46

9/7/2011 17:53

10.54

CONCORD    

CA

 

8782

FS 

1111

201.32

10/7/2011 13:48

9.22

CONCORD    

CA

 

8782

FS 

1111

2

10/23/2011 23:11

7.22

WALNUT CREEK

CA

 

8782

FS 

1111

7.22

10/26/2011 18:51

0

WALNUT CREEK

CA

 

8530

FS 

1111

6.81

8/10/2011 15:58

193.32

PACIFICA   

CA

 

8530

FS 

1111

3.52

8/10/2011 17:09

189.8

PACIFICA   

CA

 

8530

FS 

1111

2.22

8/10/2011 19:39

187.58

PACIFICA   

CA

 

8530

FS 

1111

62.39

8/10/2011 20:11

125.19

PACIFICA   

CA

 

8530

FS 

1111

13.56

8/13/2011 23:54

111.63

PACIFICA   

CA

 

8530

FS 

1111

22.78

8/14/2011 16:37

88.85

PACIFICA   

CA

 

 

 

 

 

 

 

 

 

 

 

 

 

case file

 

one record per case.

 

 

 

 

 

Variables from this file should be added to each record of the transaction file by case_id.

 

 

 

 

 

If case_id appears in this file, the case_id should appear in the transactions file.

 

 

 

 

 

 

 

 

 

case_id

addr1

city

state

zip

 

6671

 

 

 

 

 

8530

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Desired Result File

 

case_id

 

 

 

 

 

 

 

 

 

addr1

etc

 

 

6671

FS 

85801

1111

10.61

10/19/2011 13:35

283.52

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

8.98

10/23/2011 20:08

274.54

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

9.42

10/24/2011 20:27

265.12

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

6.74

10/27/2011 12:10

258.38

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

8530

FS 

185704

1111

6.81

8/10/2011 15:58

193.32

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

3.52

8/10/2011 17:09

189.8

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

2.22

8/10/2011 19:39

187.58

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

62.39

8/10/2011 20:11

125.19

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

13.56

8/13/2011 23:54

111.63

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

22.78

8/14/2011 16:37

88.85

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

 

 

 

Sydelle Raffe

Management Analyst

Office of Data Management

Information Services Division

510-271-9174 (29174)

 

I'm not an outlier; I just haven't found my distribution yet! -- Ronan M. Conroy, Lecturer in Biostatistics, Royal College of Surgeons of Ireland

 

Reply | Threaded
Open this post in threaded view
|

Re: matching and merging

Hector Maletta

I do not believe all the data are missing. MATCH FILES is a transformation command, and as such, it takes effect only after been executed. Among SPSS options you may have established that transformation commands are executed as they are issued, or held unexecuted until the next command that requires reading the data (or until you order the execution of pending transformations). If you have established the option that transformations are not immediately executed, issuing a MATCH FILES command would create the new file with all its variables, but data will not be read; as a result, all variables will be blank until the transformation is actually executed.

You can execute pending transformation by issuing the command EXECUTE, or clicking “Run pending transformations” in the Transform menu option, or posing your cursor in the MATCH FILES command and clicking on the arrow point in the toolbar of your syntax file.

I expect this would produce the “miracle” of populating the new file with data.

If that is so, SAVE the new file under a different name, e.g. ‘new combined file’, in order to preserve the original files along with the new one.

Hope this helps.

Hector

 

De: Raffe, Sydelle, SSA [mailto:[hidden email]]
Enviado el: Tuesday, April 10, 2012 23:57
Para: 'Hector Maletta'; SPSSX-L@LIS
TSERV.UGA.EDU
Asunto: RE: matching and merging

 

Thank you. It runs perfectly creating all the variables in one file. Unfortunately, all the data are missing!  At least that’s a new outcome! I think I’ll try again tomorrow.

 


From: Hector Maletta [[hidden email]]
Sent: Tuesday, April 10, 2012 6:45 PM
To: Raffe, Sydelle, SSA; [hidden email]
Subject: RE: matching and merging

 

You have to treat your “case file” as a keyed table, so that the data for each “case” are copied into each transaction record in the “transaction file”.

 

SYNTAX (substitute the proper pathname for each file):

 

GET FILE ‘transaction file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘transaction file’.

 

GET FILE ‘case file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘case file’.

 

MATCH FILES / FILE = ‘transaction file’ / TABLE = ‘case file’ / BY case_id.

 

You can achieve the same via menu, of course.

 

Hector

 

 

De: SPSSX(r) Discussion [[hidden email]] En nombre de Raffe, Sydelle, SSA
Enviado el: Tuesday, April 10, 2012 20:19
Para: [hidden email]
Asunto: matching and merging

 

I have two data files I’m trying to fuse together. But, I’m in a paper bag and can’t find my way out. I have tried to break the task down to simplify it but that’s not working for me. Well, anything I’ve tried hasn’t been working. Below I describe the two files and provide a picture of the desired resulting file. Thank you as always.

 

transaction file

Many transactions to each case.

 

 

 

 

 

 

 

 

 

Not all cases belong, only those in the case file (below).

 

 

 

 

 

 

 

 

 

Keep all variables.

 

 

 

 

 

 

 

 

 

Add variables from the case file (below)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

case_id

 

 

 

 

 

 

 

 

 

6671

FS 

1111

10.61

10/19/2011 13:35

283.52

RICHMOND   

CA

 

6671

FS 

1111

8.98

10/23/2011 20:08

274.54

RICHMOND   

CA

 

6671

FS 

1111

9.42

10/24/2011 20:27

265.12

RICHMOND   

CA

 

6671

FS 

1111

6.74

10/27/2011 12:10

258.38

RICHMOND   

CA

 

8782

FS 

1111

8.79

8/7/2011 23:44

191.21

PLEASANT HIL

CA

 

8782

FS 

1111

151.31

8/8/2011 19:15

39.9

CONCORD    

CA

 

8782

FS 

1111

6.07

8/8/2011 21:15

33.83

WALNUT CREEK

CA

 

8782

FS 

1111

33.83

8/16/2011 18:52

0

CONCORD    

CA

 

8782

FS 

1111

189.46

9/7/2011 17:53

10.54

CONCORD    

CA

 

8782

FS 

1111

201.32

10/7/2011 13:48

9.22

CONCORD    

CA

 

8782

FS 

1111

2

10/23/2011 23:11

7.22

WALNUT CREEK

CA

 

8782

FS 

1111

7.22

10/26/2011 18:51

0

WALNUT CREEK

CA

 

8530

FS 

1111

6.81

8/10/2011 15:58

193.32

PACIFICA   

CA

 

8530

FS 

1111

3.52

8/10/2011 17:09

189.8

PACIFICA   

CA

 

8530

FS 

1111

2.22

8/10/2011 19:39

187.58

PACIFICA   

CA

 

8530

FS 

1111

62.39

8/10/2011 20:11

125.19

PACIFICA   

CA

 

8530

FS 

1111

13.56

8/13/2011 23:54

111.63

PACIFICA   

CA

 

8530

FS 

1111

22.78

8/14/2011 16:37

88.85

PACIFICA   

CA

 

 

 

 

 

 

 

 

 

 

 

 

 

case file

 

one record per case.

 

 

 

 

 

Variables from this file should be added to each record of the transaction file by case_id.

 

 

 

 

 

If case_id appears in this file, the case_id should appear in the transactions file.

 

 

 

 

 

 

 

 

 

case_id

addr1

city

state

zip

 

6671

 

 

 

 

 

8530

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Desired Result File

 

case_id

 

 

 

 

 

 

 

 

 

addr1

etc

 

 

6671

FS 

85801

1111

10.61

10/19/2011 13:35

283.52

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

8.98

10/23/2011 20:08

274.54

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

9.42

10/24/2011 20:27

265.12

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

6.74

10/27/2011 12:10

258.38

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

8530

FS 

185704

1111

6.81

8/10/2011 15:58

193.32

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

3.52

8/10/2011 17:09

189.8

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

2.22

8/10/2011 19:39

187.58

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

62.39

8/10/2011 20:11

125.19

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

13.56

8/13/2011 23:54

111.63

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

22.78

8/14/2011 16:37

88.85

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

 

 

 

Sydelle Raffe

Management Analyst

Office of Data Management

Information Services Division

510-271-9174 (29174)

 

I'm not an outlier; I just haven't found my distribution yet! -- Ronan M. Conroy, Lecturer in Biostatistics, Royal College of Surgeons of Ireland

 

Reply | Threaded
Open this post in threaded view
|

Re: matching and merging

Raffe, Sydelle, SSA

It’s embarrassing. I’ve worked with SPSS since 7.5 and I managed to forget the exe (as well as a few other things). I can’t thank you enough for seeing my issues so clearly and solving them. I waited much too long to ask for help.

 


From: Hector Maletta [mailto:[hidden email]]
Sent: Tuesday, April 10, 2012 8:05 PM
To: Raffe, Sydelle, SSA; [hidden email]
Subject: RE: matching and merging

 

I do not believe all the data are missing. MATCH FILES is a transformation command, and as such, it takes effect only after been executed. Among SPSS options you may have established that transformation commands are executed as they are issued, or held unexecuted until the next command that requires reading the data (or until you order the execution of pending transformations). If you have established the option that transformations are not immediately executed, issuing a MATCH FILES command would create the new file with all its variables, but data will not be read; as a result, all variables will be blank until the transformation is actually executed.

You can execute pending transformation by issuing the command EXECUTE, or clicking “Run pending transformations” in the Transform menu option, or posing your cursor in the MATCH FILES command and clicking on the arrow point in the toolbar of your syntax file.

I expect this would produce the “miracle” of populating the new file with data.

If that is so, SAVE the new file under a different name, e.g. ‘new combined file’, in order to preserve the original files along with the new one.

Hope this helps.

Hector

 

De: Raffe, Sydelle, SSA [mailto:[hidden email]]
Enviado el: Tuesday, April 10, 2012 23:57
Para: 'Hector Maletta'; SPSSX-L@LISTSERV.UGA.EDU
Asunto: RE: matching and merging

 

Thank you. It runs perfectly creating all the variables in one file. Unfortunately, all the data are missing!  At least that’s a new outcome! I think I’ll try again tomorrow.

 


From: Hector Maletta [[hidden email]]
Sent: Tuesday, April 10, 2012 6:45 PM
To: Raffe, Sydelle, SSA; [hidden email]
Subject: RE: matching and merging

 

You have to treat your “case file” as a keyed table, so that the data for each “case” are copied into each transaction record in the “transaction file”.

 

SYNTAX (substitute the proper pathname for each file):

 

GET FILE ‘transaction file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘transaction file’.

 

GET FILE ‘case file’.

SORT CASES BY case_id.

SAVE OUTFILE ‘case file’.

 

MATCH FILES / FILE = ‘transaction file’ / TABLE = ‘case file’ / BY case_id.

 

You can achieve the same via menu, of course.

 

Hector

 

 

De: SPSSX(r) Discussion [[hidden email]] En nombre de Raffe, Sydelle, SSA
Enviado el: Tuesday, April 10, 2012 20:19
Para: [hidden email]
Asunto: matching and merging

 

I have two data files I’m trying to fuse together. But, I’m in a paper bag and can’t find my way out. I have tried to break the task down to simplify it but that’s not working for me. Well, anything I’ve tried hasn’t been working. Below I describe the two files and provide a picture of the desired resulting file. Thank you as always.

 

transaction file

Many transactions to each case.

 

 

 

 

 

 

 

 

 

Not all cases belong, only those in the case file (below).

 

 

 

 

 

 

 

 

 

Keep all variables.

 

 

 

 

 

 

 

 

 

Add variables from the case file (below)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

case_id

 

 

 

 

 

 

 

 

 

6671

FS 

1111

10.61

10/19/2011 13:35

283.52

RICHMOND   

CA

 

6671

FS 

1111

8.98

10/23/2011 20:08

274.54

RICHMOND   

CA

 

6671

FS 

1111

9.42

10/24/2011 20:27

265.12

RICHMOND   

CA

 

6671

FS 

1111

6.74

10/27/2011 12:10

258.38

RICHMOND   

CA

 

8782

FS 

1111

8.79

8/7/2011 23:44

191.21

PLEASANT HIL

CA

 

8782

FS 

1111

151.31

8/8/2011 19:15

39.9

CONCORD    

CA

 

8782

FS 

1111

6.07

8/8/2011 21:15

33.83

WALNUT CREEK

CA

 

8782

FS 

1111

33.83

8/16/2011 18:52

0

CONCORD    

CA

 

8782

FS 

1111

189.46

9/7/2011 17:53

10.54

CONCORD    

CA

 

8782

FS 

1111

201.32

10/7/2011 13:48

9.22

CONCORD    

CA

 

8782

FS 

1111

2

10/23/2011 23:11

7.22

WALNUT CREEK

CA

 

8782

FS 

1111

7.22

10/26/2011 18:51

0

WALNUT CREEK

CA

 

8530

FS 

1111

6.81

8/10/2011 15:58

193.32

PACIFICA   

CA

 

8530

FS 

1111

3.52

8/10/2011 17:09

189.8

PACIFICA   

CA

 

8530

FS 

1111

2.22

8/10/2011 19:39

187.58

PACIFICA   

CA

 

8530

FS 

1111

62.39

8/10/2011 20:11

125.19

PACIFICA   

CA

 

8530

FS 

1111

13.56

8/13/2011 23:54

111.63

PACIFICA   

CA

 

8530

FS 

1111

22.78

8/14/2011 16:37

88.85

PACIFICA   

CA

 

 

 

 

 

 

 

 

 

 

 

 

 

case file

 

one record per case.

 

 

 

 

 

Variables from this file should be added to each record of the transaction file by case_id.

 

 

 

 

 

If case_id appears in this file, the case_id should appear in the transactions file.

 

 

 

 

 

 

 

 

 

case_id

addr1

city

state

zip

 

6671

 

 

 

 

 

8530

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Desired Result File

 

case_id

 

 

 

 

 

 

 

 

 

addr1

etc

 

 

6671

FS 

85801

1111

10.61

10/19/2011 13:35

283.52

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

8.98

10/23/2011 20:08

274.54

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

9.42

10/24/2011 20:27

265.12

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

6671

FS 

85801

1111

6.74

10/27/2011 12:10

258.38

BARRETT AVENUE    

RICHMOND   

CA

 

 

 

 

8530

FS 

185704

1111

6.81

8/10/2011 15:58

193.32

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

3.52

8/10/2011 17:09

189.8

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

2.22

8/10/2011 19:39

187.58

100 CLARENDON RD      

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

62.39

8/10/2011 20:11

125.19

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

13.56

8/13/2011 23:54

111.63

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

8530

FS 

185704

1111

22.78

8/14/2011 16:37

88.85

1380 LINDA MAR SHP CENT

PACIFICA   

CA

 

 

 

 

 

 

 

Sydelle Raffe

Management Analyst

Office of Data Management

Information Services Division

510-271-9174 (29174)

 

I'm not an outlier; I just haven't found my distribution yet! -- Ronan M. Conroy, Lecturer in Biostatistics, Royal College of Surgeons of Ireland