23.07.2013 Views

Basic data operations in SPSS - ISS - University of Leeds

Basic data operations in SPSS - ISS - University of Leeds

Basic data operations in SPSS - ISS - University of Leeds

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Basic</strong> <strong>data</strong> <strong>operations</strong> <strong>in</strong> <strong>SPSS</strong> for W<strong>in</strong>dows 17<br />

Version 6 (November 2009)<br />

Note: If a column displays asterisks (*****), simply widen the column to see the <strong>data</strong>. This can<br />

be done by po<strong>in</strong>t<strong>in</strong>g the mouse to the boundary between the cells, and dragg<strong>in</strong>g to the right<br />

when the mouse po<strong>in</strong>ter changes to a double headed arrow.<br />

Figure 44: Widen<strong>in</strong>g the column width<br />

A practical consideration <strong>in</strong> perform<strong>in</strong>g a merge is the order <strong>in</strong> which the two files are specified.<br />

They can be specified <strong>in</strong> either order, but the choice is important because it can affect the<br />

variable def<strong>in</strong>itions assigned to common variables <strong>in</strong> the merged file. For example, if a numeric<br />

variable common to both files has a decimal places value <strong>of</strong> 0 <strong>in</strong> the active file and 2 <strong>in</strong> the file<br />

be<strong>in</strong>g added, the value assigned <strong>in</strong> the merged file would be 0. If the active file is our master<br />

file, then this might be acceptable. But if the file be<strong>in</strong>g added was our master file, then this<br />

would probably not be acceptable s<strong>in</strong>ce it would mean that we are over-rid<strong>in</strong>g def<strong>in</strong>itions which<br />

we have laid down <strong>in</strong> our master file.<br />

The conclusion might be, therefore, to always open the master file first and to add cases from<br />

the second file. Whilst this would prevent the possibility <strong>of</strong> master def<strong>in</strong>itions be<strong>in</strong>g changed, it<br />

would also prevent us from chang<strong>in</strong>g any other def<strong>in</strong>itions <strong>in</strong> the active file prior to the merge.<br />

Accord<strong>in</strong>gly, <strong>in</strong> this example, we have chosen to open the file conta<strong>in</strong><strong>in</strong>g the new cases first so<br />

that we can change the active file prior to the merge. This approach does require, <strong>of</strong> course,<br />

that care is taken to ensure that master def<strong>in</strong>itions are not <strong>in</strong>advertently changed. The motto<br />

must therefore be: caution.<br />

Task 14 Add<strong>in</strong>g variables<br />

Objective To add variables to the work<strong>in</strong>g file from another <strong>SPSS</strong> <strong>data</strong> file.<br />

Comment This illustrates the use <strong>of</strong> the Add Variables under Merge.<br />

Problem The <strong>data</strong> file possums1.sav conta<strong>in</strong>s 2 <strong>data</strong> cases and 16 variables. The file possums2.sav<br />

conta<strong>in</strong>s 3 new variables plus the common key variable patid with values 600 and 601. It is<br />

necessary to comb<strong>in</strong>e the two sets <strong>of</strong> variables <strong>in</strong>to one <strong>data</strong> file.<br />

Activity 14.1 Open the file possums1.sav from the directory <strong>in</strong> which your <strong>SPSS</strong> example <strong>data</strong> sets are<br />

stored.<br />

Activity 14.2 Select Data>Merge Files>Add Variables.<br />

Activity 14.3 Choose the file possums2.sav.<br />

This file conta<strong>in</strong>s three variables id, height and weight with entries for patients with patid 600<br />

and 601.<br />

The follow<strong>in</strong>g dialog w<strong>in</strong>dow will be opened.<br />

Information Systems Services Page 34 <strong>of</strong>36<br />

Version 4.1 (December 2006) tut113_vn17nov2009.doc}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!