21
1 SPSS Tutorial 101: SPSS Tutorial 101: Import, Merge and Save Import, Merge and Save Data Sets Data Sets Dr. Daisy Dai Dr. Daisy Dai Department of Medical Department of Medical Research Research

SPSS Tutorial 101: Import, Merge and Save Data Sets

  • Upload
    lilike

  • View
    64

  • Download
    0

Embed Size (px)

DESCRIPTION

SPSS Tutorial 101: Import, Merge and Save Data Sets. Dr. Daisy Dai Department of Medical Research. Example: CDC Survey Data. An allergy survey was conducted in 2005 and 2006 to children more than 1 year old. - PowerPoint PPT Presentation

Citation preview

Page 1: SPSS Tutorial 101: Import, Merge and Save Data Sets

11

SPSS Tutorial 101: Import, SPSS Tutorial 101: Import, Merge and Save Data SetsMerge and Save Data Sets

Dr. Daisy DaiDr. Daisy Dai

Department of Medical Department of Medical ResearchResearch

Page 2: SPSS Tutorial 101: Import, Merge and Save Data Sets

22

Example: CDC Survey DataExample: CDC Survey Data

An allergy survey was conducted in An allergy survey was conducted in 2005 and 2006 to children more than 2005 and 2006 to children more than 1 year old. 1 year old.

Two data sets, allergy questionnaire Two data sets, allergy questionnaire and demographic information, are and demographic information, are saved in sas export format. saved in sas export format.

Page 3: SPSS Tutorial 101: Import, Merge and Save Data Sets

33

TasksTasks

Import these two SAS data files to Import these two SAS data files to SPSS and save them as SPSS data SPSS and save them as SPSS data file. file.

Sort each data set by study ID.Sort each data set by study ID. Merge allergy variables and Merge allergy variables and

demographic variables.demographic variables. Save new data set as SPSS data file. Save new data set as SPSS data file.

Page 4: SPSS Tutorial 101: Import, Merge and Save Data Sets

44

Log in SPSS Log in SPSS

CMH offers server CMH offers server version SPSS 18. Any version SPSS 18. Any employee can log in employee can log in SPSS from your SPSS from your employee account.employee account.

Go to Go to Start Start

->Program->Program

->Accessories->Accessories

-> Remote -> Remote Desktop Desktop ConnectionConnection

Page 5: SPSS Tutorial 101: Import, Merge and Save Data Sets

55

Log in SPSS Log in SPSS

In the prompted In the prompted connection connection window, enter window, enter cmhterm. cmhterm.

ClickClick Connect. Connect.

Page 6: SPSS Tutorial 101: Import, Merge and Save Data Sets

66

Log in SPSS Log in SPSS

In the Log On In the Log On Window, enter your Window, enter your cmh user namecmh user name and and passwordpassword. .

Choose log on to Choose log on to CMHCMH

ClickClick OK. OK.

Page 7: SPSS Tutorial 101: Import, Merge and Save Data Sets

77

Task 1: Import Data Task 1: Import Data

We need to import two data sets to SPSS.We need to import two data sets to SPSS. Allergy qustionaire: Allergy qustionaire: aqq_d.xptaqq_d.xpt (xpt is sas export (xpt is sas export

file)file) Demographic information: Demographic information: demo_d.xptdemo_d.xpt

Please note that SPSS is on server and data Please note that SPSS is on server and data must be saved in shared drive such as must be saved in shared drive such as u u drive or w drivedrive or w drive. You will not be able to find . You will not be able to find the file in SPSS if you save them on your local the file in SPSS if you save them on your local disk.disk.

Page 8: SPSS Tutorial 101: Import, Merge and Save Data Sets

88

Task 1: Import Data Task 1: Import Data

Double click spss Double click spss 18 icon on the 18 icon on the screen. screen.

In the task wizard, In the task wizard, click click Open an Open an existing sourceexisting source..

Click Click OKOK..

Page 9: SPSS Tutorial 101: Import, Merge and Save Data Sets

99

Task 1: Import Data Task 1: Import Data

Just in case wizard Just in case wizard does not prompt, does not prompt, you can go to you can go to filefile

-> -> OpenOpen

-> -> DataData

Page 10: SPSS Tutorial 101: Import, Merge and Save Data Sets

1010

Task 1: Import Data Task 1: Import Data

Select Select the folderthe folder. . Choose Choose agg_d fileagg_d file.. Select Select xpt formatxpt format.. Click Click OpenOpen..

Note: SPSS is Note: SPSS is compatible with other compatible with other commonly used commonly used statistical and data statistical and data management software management software packages. Excel, SAS, packages. Excel, SAS, Access files are all Access files are all convertible to SPSS. convertible to SPSS.

Page 11: SPSS Tutorial 101: Import, Merge and Save Data Sets

1111

Task 1: Import Data Task 1: Import Data

Now the data is Now the data is open. open.

You can see the You can see the data in “data in “data Viewdata View” ” tab.tab.

Page 12: SPSS Tutorial 101: Import, Merge and Save Data Sets

1212

Task 1: Import Data Task 1: Import Data

The data structure, The data structure, variable name, variable name, label, etc. are in label, etc. are in ““Variable ViewVariable View” ” tab. tab.

Page 13: SPSS Tutorial 101: Import, Merge and Save Data Sets

1313

Task 2: Sort Data Task 2: Sort Data

Variable to be sort: Variable to be sort: SEQNSEQN, that is, , that is, Respondent sequence number. Respondent sequence number.

Page 14: SPSS Tutorial 101: Import, Merge and Save Data Sets

1414

Task 2: Sort Data Task 2: Sort Data

Go to Go to DataData and select and select Sort CasesSort Cases..

On On Sort Cases pageSort Cases page, , select the variable, select the variable, Respondent sequence Respondent sequence numbernumber..

Click on Click on right arrowright arrow.. Choose Choose AscendingAscending or or

DescendingDescending.. Click Click OKOK. .

Page 15: SPSS Tutorial 101: Import, Merge and Save Data Sets

1515

PracticePractice

Now let repeat this process by doing Now let repeat this process by doing the following:the following: Open the demographic data, Open the demographic data,

demo_d.xptdemo_d.xpt.. Sort the data by variable, Sort the data by variable, Respondent Respondent

Sequence NumberSequence Number. .

Page 16: SPSS Tutorial 101: Import, Merge and Save Data Sets

1616

Task 3: Merge Two Data Task 3: Merge Two Data SetsSets

Two data sets need to be linked by Two data sets need to be linked by key variables.key variables.

In our case, the key variable is In our case, the key variable is SEQN-SEQN-Respondent Sequence NumberRespondent Sequence Number..

Make sure the key variable has the Make sure the key variable has the same name and variable type in two same name and variable type in two data sets. data sets.

Both data sets needs to be sorted by Both data sets needs to be sorted by the key variable. the key variable.

Page 17: SPSS Tutorial 101: Import, Merge and Save Data Sets

1717

Task 3: Merge Two Data Task 3: Merge Two Data SetsSets

Under any data Under any data set, go to set, go to DataData

-> -> Merge FileMerge File

-> -> Add VariablesAdd Variables

Page 18: SPSS Tutorial 101: Import, Merge and Save Data Sets

1818

Task 3: Merge Two Data Task 3: Merge Two Data SetsSets

Choose the other Choose the other data to add on. data to add on.

Note, this page will Note, this page will look different in look different in SPSS 18. By all SPSS 18. By all means, choose the means, choose the other data set. other data set.

Page 19: SPSS Tutorial 101: Import, Merge and Save Data Sets

1919

Task 4: Save the New DataTask 4: Save the New Data

Go to Go to FileFile

-> -> Save As…Save As… Select Select the folderthe folder.. Create new file, Create new file,

MergedDataMergedData.. Choose Choose SPSS data SPSS data

formatformat. . Click Click SaveSave..

Page 20: SPSS Tutorial 101: Import, Merge and Save Data Sets

2020

Task 4: Save the New DataTask 4: Save the New Data

Go to Go to DataData

-> -> Merge FileMerge File

-> -> Add VariablesAdd Variables

Page 21: SPSS Tutorial 101: Import, Merge and Save Data Sets

2121

Thank you!Thank you!