Data Entry:

10 Data Entry Input your answers (i.e., raw data) into your computer Then, please also input FOUR of your classmates’ answer into your existing data file  to make it 5 cases in total ! IDNO = should be UNIQUE! (e.g., set your own questionnaire as 1, and your classmates’ as 2, 3, 4, and 5) Save it as “MM3761.sav” variables cases

Data Entry:

11 Data Entry Merge your data with my Data Merge two files with same variables but different cases Merge two files with same cases but different variables variables cases

Merging Files – with same variables (i.e., add more cases) (i.e., add questionnaires from different respondents):

12 Merging Files – with same variables (i.e., add more cases) (i.e., add questionnaires from different respondents) Working Data File : The file that you have opened and are working on. i.e., “MM3761.sav” External Data File : The file from which you want to add cases to the working file. i.e., “MM3761_for merge_cases” Procedure: Open the working data file (i.e., MM3761.sav) SORT cases according to an identification variable (e.g., ID No.). Click “Data”  “Sort case”  Select the variable you want the cases to be sorted accordingly choose sort order OK. OR simply placing your mouse on the variable and right click  “ascending” or “descending” Click “Data”  “Merge files”  “Add Cases” Browse the file (the one you want to be merged). Click “OK” Results: Now, the file should be 30 cases in total. 6.00 5.00 …………………. 7.00 6.00…………………… 8.00 1.00 …………………….

Merging Files – with same variables:

13 Merging Files – with same variables Note: If you want to indicate the case sources, you can choose “Indicate case source as variable”, which will denote 0 for cases from the working file and 1 for those from the external file.

Merging Files – with same cases (i.e., add more variables/ add more questions from the same respondents):

14 Merging Files – with same cases (i.e., add more variables/ add more questions from the same respondents) Working Data File : The file that you have opened and are working on. i.e., “MM3761.sav” External Data File : The file from which you want to draw variables. i.e., “MM3761_for merge_variables” Procedure: Open the working data file (i.e., MM3761.sav) Sort cases according to an identification variable (e.g., ID no.). Click “Data”  “Merge Files”  “Add variables” Browse the file Click “OK”  you can see the newly added variables. In (5), the “New active dataset” lists all the variables that will appear in y our newly merged file. Variables with (+) signs are from the external file while those with asterisk (*) sign are from the working file. Cases from the external file need to be matched with the cases from the working file by an identification variable. You need to tick the “ Match cases on key variables in sorted files ” box. Then move the variable to be matched from the “Excluded Variables” box to the “ Key Variables ” box. Price 2.00 3.00 4.00 1.00 2.00 . ..

Check “missing data”:

19 Check “missing data” Data sorting (ascending order) Way 1 :  Way 2: Simply placing your mouse on the “variable” and right click  choose “Sort ascending” Data Sort Cases Practice 2: Please check the missing data of all variables using any of the above ways. How many missing data can you find in the file? And where are they? Using the datafile: “customer loyalty_data_unclean.sav” Answer: ONE missing data Appears in “Gender” ID = 845

Check “missing data”:

20 Check “missing data” Frequency count Click   Analyze Frequencies Descriptive Statistics Press SHIFT To highlight the range of variables you want and put them to the right box.

Frequency count—results :

21 Frequency count—results Now, you can go back to the SPSS file, sort the variable of gender with ascending order and find its corresponding ID no.

How to deal with “Missing Values”?:

22 How to deal with “Missing Values”? Way 1: Delete the whole case Way 2: Ignore it Way 3: Replace it with “mean” Using “descriptive statistics”  find “mean” & manually replace it with the “missing value”. Type in 1.5023 Note: have to make sure whether this figure makes sense!

How to deal with “Missing Values”?:

23 How to deal with “Missing Values”? Way 1: Delete the whole case Way 2: Ignore it Way 3: Replace it with “mean” Using “descriptive statistics”  find “mean” & manually replace it with the “missing value”. OR click  Transform Replacing Missing Values Create a NEW variable in the data file Remember to write the labeling of this NEW variable in the code book

Data Cleaning:

24 Data Cleaning 3.2: Check “wrong data” “ are the scores out of the scale range?” E.g., inputs like “0” or “8” Run “Frequency Count” and check the score distribution

Data Cleaning:

25 Data Cleaning 3.2: Check “wrong data” “ are the scores out of the scale range?” E.g., inputs like “0” or “8” Run “Frequency Count” and check the score distribution Practice 3: Perform the Frequency Count of all variables and find out: How many wrong data are there in the file? Where are they? Answer: ONE wrong data input – “8” Appears in “Loyalty toward the restaurant” (ID109)

Other Data Transformation Techniques:

27 Other Data Transformation Techniques Case selection Use to select only a specified group of cases that you are interested in. E.g., if you want to know only the Male ’s comments and ratings. You should select only the cases of Male and neglect the group of Female Procedures: Click  Data Select Cases

Case Selection:

28 Case Selection

Case Selection: Male only:

29 Case Selection: Male only

Practice: Case Selection:

30 Practice: Case Selection Find out the “Mean” of “satisfaction” rating based on the case selection of “married” customers only.

Case Selection: NOTE:

31 Case Selection: NOTE Make sure to deselect the cases before working on other analyses!

Other Data Transformation Techniques:

32 Other Data Transformation Techniques File Splitting Use to run analyses separately for each group. E.g., you may want to know the mean of satisfaction for female & male respectively? Procedures: Click  Data Split File

Splitting Files-organize output by groups:

33 Splitting Files-organize output by groups

Splitting Files:

34 Splitting Files OUTPUT Female Male

Splitting Files:

35 Splitting Files

Splitting files— compare groups:

36 Splitting files— compare groups

Case Selection: NOTE:

37 Case Selection: NOTE Make sure to deselect the cases before working on other analyses!

Other Data Transformation Techniques:

38 Other Data Transformation Techniques Variables Recoding Recode is necessary when you want to reverse some variables to get them in line with their conceptual meanings. It also helps you explore different categorization of variables. Recode into same variable Recode the values within the same variables and replace the original values. Recode into different variable Recode the values by creating a new variable from the original one.

Recode into same variable:

Recode into same variable:

40 Recode into same variable 5 -->3 Go back to the data file & run frequency count for the variable of “relationship duration”, what happens? Save the file as “test.sav”.

Recode into same variable:

41 Recode into same variable Original one

Recode into Different Variable:

42 Recode into Different Variable Procedure: Close the “test.sav” file and reopen the “Customer loyalty_cleaned.sav” file. Now, using “Expend” (monthly expenditure) as an example and save it as “Expend2” Click   Label this new variable. Transform Recode Into Different Variables Old Value New Value 1, 2 1 3 2 4,5 3

Recode into Different Variable:

43 Recode into Different Variable 5 -->3

Recode into Different Variable:

44 Recode into Different Variable Run a frequency count for “expend” and “expend2” and compare the results. Important note: Every time you create a new variable, remember to put a new label and insert the values for it.

Practice: Recode into Different Variable:

45 Practice: Recode into Different Variable New Old

Other Data Transformation Techniques:

46 Other Data Transformation Techniques Variables Computing Use to create a new variable that based on numerical transformation. E.g., you want to combine the variables of “satisfaction” and “loyalty” through averaging their scores. Procedure: Click  Transform Compute

Variable computing:

47 Variable computing Label it! You can copy it from the equation or self create one.

Exercise for File Handling & Data Transformation:

Exercise for File Handling & Data Transformation:

49 Exercise for File Handling & Data Transformation Questions: Add 5 more cases from the file “Loyalty_cases” to the file “Loyalty.sav” (hint: open the file of “Loyalty.sav” first) Save it after merging the cases. 2. Now, add the variable(s) that appear(s) in file Loyalty_variables” to the file Loyalty.sav. ( please save the file as Loyalty_uncleaned.sav and use it for the following questions ) 3. Based on the new file of Loyalty_uncleaned.sav, there are some missing values, where are they? Please help replace them with mean. 4. Based on the new file of Loyalty_uncleaned.sav, there are one wrong value, where is it? Please help remove the case.

Exercise for File Handling & Data Transformation:

50 Exercise for File Handling & Data Transformation Questions: Please sort the file by descending order of the student’s frequency of visit. If male respondents were mistakenly entered as female respondents and vice versa, what would you do to correct the mistakes? 6. Can you create a variable called “servfood” that reflects the average of respondents’ ratings for both service & food quality? What is the average ratings of the “servfood”? 7. Now a restaurant manager wants to interview students who study at year 2 or above. So how many students would be qualified for the interview? 8. Now the restaurant manager is only interested in knowing the loyalty of female customers, what would you do?