* Encoding: UTF-8. * Encoding: . *********************************Tableware study (Size and shape of plates and size of wine glasses and bottles: impact on selection of food and alcohol) ****************************************** ***This syntax will recode the raw data for the Tableware study and bring it into SPSS (v24). It will create all new variables needed for analysis. ***The syntax was created by Katie De-loyde (Bristol University) on 16/07/2020 ***The syntax was checked and edited by NC (Cambridge University) on 07/08/2020 ***bring raw data into SPSS from Excel (use your own file name)*** GET DATA /TYPE=XLSX /FILE='Tableware_RawData_v1.0_20200820.xlsx' /SHEET=name 'Participant data' /CELLRANGE=FULL /READNAMES=ON /DATATYPEMIN PERCENTAGE=95.0 /HIDDEN IGNORE=YES. EXECUTE. DATASET NAME DataSet1 WINDOW=FRONT. ***labelling of categorical and other variables as per the data dictionary*************************************************************** VALUE LABELS Sex 1 "Male" 2 "Female" 3 "Other" 4 "Prefer not to say". EXECUTE. VALUE LABELS Ethnicity 1 "White British" 2 "Mixed/Multiple Ethnic Groups" 3 "Asian/Asian British" 4 "Black/African/Caribbean/Black British" 5 "Other ethnic group" 6 "Prefer not to say". EXECUTE. VALUE LABELS Qualifications 1 "None" 2 "Up to 4 GCSEs (Including 1-4 O Levels/CSE/GCSEs (any grades), or equivalent" 3 "5 or more GCSEs or 1 A-level" 4 "2 or more A-levels" 5 "Bachelor’s degree" 6 "Post-Graduate degree or qualification" 7 "Other vocational/work-related qualifications" 8 "Prefer not to say". EXECUTE. VARIABLE LEVEL Qualifications (NOMINAL). VALUE LABELS BMIcode 1 "underweight (under 18.5)" 2 "healthy weight (18.5-24.9)" 3 "overweight (25-29.9)" 4 "obese (30-34.9)" 5 "severely obese (35-39.9)" 6 "morbidly obese (40+)" -888 "Rather not say". EXECUTE. VARIABLE LEVEL BMIcode (NOMINAL). MISSING VALUES Sex Age Ethnicity Qualifications BMI BMIcode (-999, -888). AUTORECODE VARIABLES= StudyaimGuessedaim /INTO Studyaim_guessed /GROUP /BLANK=MISSING /PRINT. AUTORECODE VARIABLES=StudyaimSpecfiedcorrectdirection /INTO Studyaim_direction /GROUP /BLANK=MISSING /PRINT. VALUE LABELS StudyaimProductspecified 1 "food" 2 "wine" 3 "both" 4 "none". EXECUTE. VARIABLE LEVEL StudyaimProductspecified (NOMINAL). MISSING VALUES StudyaimProductspecified Studyaim_guessed Studyaim_direction (-999). VARIABLE LABELS Studyaim_guessed (Study aim: Guessed aim). VARIABLE LABELS Studyaim_direction (Study aim: Specified correct direction). VARIABLE LABELS StudyaimProductspecified (Study aim: Product specified). ***sequences for plates and wine (did the wine study or the plate study happen first)*** AUTORECODE VARIABLES=Sequence_1stInt /INTO Sequence_rice_or_wine_first /GROUP /BLANK=MISSING /PRINT. VARIABLE LABELS Sequence_rice_or_wine_first (Which intervention was completed first). RECODE Sequence_rice_or_wine_first (1=1) (2=1) (3=2) (4=2). EXECUTE. VALUE LABELS Sequence_rice_or_wine_first 1 "Rice first" 2 "wine first". EXECUTE. *check recode worked* CROSSTABS /TABLES=Sequence_1stInt BY Sequence_rice_or_wine_first /FORMAT=AVALUE TABLES /CELLS=COUNT /COUNT ROUND CELL. ***sequence for the plate order*** AUTORECODE VARIABLES=Sequence_rice /INTO sequence_rice_recode /GROUP /PRINT. VARIABLE LEVEL sequence_rice_recode (NOMINAL). VARIABLE LABELS sequence_rice_recode (Which order were the 6 rice conditions completed in?). VARIABLE LEVEL Sequence_wine (nominal). ***sequence for the wine order*** AUTORECODE VARIABLES=Sequence_wine /INTO Sequence_wine_recode /GROUP /PRINT. VARIABLE LEVEL Sequence_wine_recode (nominal). VARIABLE LABELS Sequence_wine_recode (Which order were the 6 wine conditions completed in?). ****************************************************************************************************** labelling outcomes******************************** VARIABLE LABELS Rice_C1_weight_difference (small square plate). VARIABLE LABELS Rice_C2_weight_difference (medium square plate). VARIABLE LABELS Rice_C3_weight_difference (large square plate). VARIABLE LABELS Rice_C4_weight_differece (small round plate). VARIABLE LABELS Rice_C5_weight_difference (medium round plate). VARIABLE LABELS Rice_C6_weight_difference (large round plate). Formats Rice_C1_weight_difference Rice_C2_weight_difference Rice_C3_weight_difference Rice_C4_weight_differece Rice_C5_weight_difference Rice_C6_weight_difference (f5.2). ***Convert grams to ml for wine as per SAP*** COMPUTE Wine_C1_weight_difference_ML=Wine_C1_weight_difference * 0.98. EXECUTE. COMPUTE Wine_C2_weight_difference_ML=Wine_C2_weight_difference * 0.98. EXECUTE. COMPUTE Wine_C3_weight_difference_ML=Wine_C3_weight_difference * 0.98. EXECUTE. COMPUTE Wine_C4_weight_difference_ML=Wine_C4_weight_difference * 0.98. EXECUTE. COMPUTE Wine_C5_weight_difference_ML=Wine_C5_weight_difference * 0.98. EXECUTE. COMPUTE Wine_C6_weight_difference_ML=Wine_C6_weight_difference * 0.98. EXECUTE. *then label the new variables. VARIABLE LABELS Wine_C1_weight_difference_ML (small glass, small bottle). VARIABLE LABELS Wine_C2_weight_difference_ML (medium glass, small bottle). VARIABLE LABELS Wine_C3_weight_difference_ML (large glass, small bottle). VARIABLE LABELS Wine_C4_weight_difference_ML (small glass, large bottle). VARIABLE LABELS Wine_C5_weight_difference_ML (medium glass, large bottle). VARIABLE LABELS Wine_C6_weight_difference_ML (large glass, large bottle). Formats Wine_C1_weight_difference_ML Wine_C2_weight_difference_ML Wine_C3_weight_difference_ML Wine_C4_weight_difference_ML Wine_C5_weight_difference_ML Wine_C6_weight_difference_ML (f5.2). ***recode variables for Table 1 (demographic table)*** RECODE Ethnicity (1=1) (2 thru 5=2) (ELSE=Copy) INTO White_Nonwhite. EXECUTE. VALUE LABELS White_Nonwhite 1 "White - British" 2 "Other" 6 "Prefer not to say". EXECUTE. ***label for Exploratory analysis*** VALUE LABELS Plate1st Plate2nd Plate3rd Plate4th Plate5th Plate6th 1 "Small square plate" 2 "Medium square plate" 3 "Large square plate" 4 "Small round plate" 5 "Medium round plate" 6 "Large round plate". EXECUTE. VALUE LABELS Wine1st Wine2nd Wine3rd Wine4th Wine5th Wine6th 1 "small glass, small bottle" 2 "medium glass, small bottle" 3 "large glass, small bottle" 4 "small glass, large bottle" 5 "medium glass, large bottle" 6 "large glass, large bottle". EXECUTE. ***save database (use own file name)*** SAVE OUTFILE='Tableware_widedata.sav' /COMPRESSED. ***stop here to use wide format database*** ******************************************to reconstruct data to long format*************** SORT CASES by Participant_ID. *** reconstruct plate data first***** VARSTOCASES /MAKE food_served_outcome FROM Rice_C1_weight_difference Rice_C2_weight_difference Rice_C3_weight_difference Rice_C4_weight_differece Rice_C5_weight_difference Rice_C6_weight_difference /INDEX=Index1(6) /KEEP=Date Participant_ID Sex Age Ethnicity Qualifications BMI BMIcode StudyaimGuessedaim StudyaimSpecfiedcorrectdirection StudyaimProductspecified Additional_comments Sequence_rice Sequence_wine Sequence_1stInt Rice_C1_preweight Rice_C1_postweight Rice_C2_preweight Rice_C2_postweight Rice_C3_preweight Rice_C3_postweight Rice_C4_preweight Rice_C4_postweight Rice_C5_preweight Rice_C5_postweight Rice_C6_preweight Rice_C6_postweight Wine_C1_preweight Wine_C1_postweight Wine_C1_weight_difference Wine_C2_preweight Wine_C2_postweight Wine_C2_weight_difference Wine_C3_preweight Wine_C3_postweight Wine_C3_weight_difference Wine_C4_preweight Wine_C4_postweight Wine_C4_weight_difference Wine_C5_preweight Wine_C5_postweight Wine_C5_weight_difference Wine_C6_preweight Wine_C6_postweight Wine_C6_weight_difference Debriefcomment Anyfurtherobservationsparticipantsmentionedanythingoryounoticeda Sensitivityanalysis2codingservedincorrectly /NULL=KEEP. AUTORECODE VARIABLES=Index1 /INTO Plate /PRINT. VALUE LABELS Plate 1 "Square, small plate" 2 "Square, medium plate" 3 "Square, large plate" 4 "Round, small plate" 5 "Round, medium plate" 6 "Round, large plate". EXECUTE. DELETE VARIABLES Date Sex Age Ethnicity Qualifications BMI BMIcode StudyaimGuessedaim StudyaimSpecfiedcorrectdirection StudyaimProductspecified Additional_comments Sequence_rice Sequence_wine Sequence_1stInt Rice_C1_preweight Rice_C1_postweight Rice_C2_preweight Rice_C2_postweight Rice_C3_preweight Rice_C3_postweight Rice_C4_preweight Rice_C4_postweight Rice_C5_preweight Rice_C5_postweight Rice_C6_preweight Rice_C6_postweight Wine_C1_preweight Wine_C1_postweight Wine_C1_weight_difference Wine_C2_preweight Wine_C2_postweight Wine_C2_weight_difference Wine_C3_preweight Wine_C3_postweight Wine_C3_weight_difference Wine_C4_preweight Wine_C4_postweight Wine_C4_weight_difference Wine_C5_preweight Wine_C5_postweight Wine_C5_weight_difference Wine_C6_preweight Wine_C6_postweight Wine_C6_weight_difference Debriefcomment Anyfurtherobservationsparticipantsmentionedanythingoryounoticeda Sensitivityanalysis2codingservedincorrectly Index1. *save database (use own file name)* SAVE OUTFILE='Tableware_platedata.sav' /COMPRESSED. ***then reconstruct wine data*** *close Tableware_platedata. And reopen Tableware_longdata (use own file name)* GET FILE='Tableware_longdata.sav'. DATASET NAME DataSet3 WINDOW=FRONT. *then reconstruct data for wine* SORT CASES by Participant_ID. VARSTOCASES /MAKE wine_served_outcome FROM Wine_C1_weight_difference_ML Wine_C2_weight_difference_ML Wine_C3_weight_difference_ML Wine_C4_weight_difference_ML Wine_C5_weight_difference_ML Wine_C6_weight_difference_ML /INDEX=Index1(6) /KEEP=Date Participant_ID Sex Age Ethnicity Qualifications BMI BMIcode StudyaimGuessedaim StudyaimSpecfiedcorrectdirection StudyaimProductspecified Additional_comments Rice_C1_preweight Rice_C1_postweight Rice_C1_weight_difference Rice_C2_preweight Rice_C2_postweight Rice_C2_weight_difference Rice_C3_preweight Rice_C3_postweight Rice_C3_weight_difference Rice_C4_preweight Rice_C4_postweight Rice_C4_weight_differece Rice_C5_preweight Rice_C5_postweight Rice_C5_weight_difference Rice_C6_preweight Rice_C6_postweight Rice_C6_weight_difference Wine_C1_preweight Wine_C1_postweight Wine_C1_weight_difference Wine_C2_preweight Wine_C2_postweight Wine_C2_weight_difference Wine_C3_preweight Wine_C3_postweight Wine_C3_weight_difference Wine_C4_preweight Wine_C4_postweight Wine_C4_weight_difference Wine_C5_preweight Wine_C5_postweight Wine_C5_weight_difference Wine_C6_preweight Wine_C6_postweight Wine_C6_weight_difference Debriefcomment Anyfurtherobservationsparticipantsmentionedanythingoryounoticeda Sensitivityanalysis2codingservedincorrectly Studyaim_guessed Studyaim_direction Sequence_rice_or_wine_first sequence_rice_recode Sequence_wine_recode White_Nonwhite /NULL=KEEP. AUTORECODE VARIABLES=Index1 /INTO Wine /PRINT. VALUE LABELS Wine 1 "Small bottle, small glass" 2 "Small bottle, medium glass" 3 "Small bottle, large glass" 4 "Large bottle, small glass" 5 "Large bottle, medium glass" 6 "Large bottle, large glass". EXECUTE. ***then merge the two files together (plate and wine) (use own file name)*** SORT CASES by Participant_ID. MATCH FILES /FILE=* /FILE='Tableware_platedata.sav' /BY Participant_ID. EXECUTE. ***save merged file as analysis file (use own file name)*** SAVE OUTFILE='For analysis 20200817- long format.sav' /COMPRESSED. ***labels*** VARIABLE LABELS Plate (plate intervention group). VARIABLE LABELS Wine (wine intervention group). *** recode into plate size and shape*** RECODE Plate (1=1) (2=2) (3=3) (4=1) (5=2) (6=3) INTO Plate_size. EXECUTE. VALUE LABELS Plate_size 1 "Small" 2 "Medium" 3 "Large". EXECUTE. RECODE Plate (1=2) (2=2) (3=2) (4=1) (5=1) (6=1) INTO Plate_shape. EXECUTE. VALUE LABELS Plate_shape 1 "Round" 2 "Square". EXECUTE. ***recode into bottle and glass size*** RECODE Wine (1=1) (2=1) (3=1) (4=2) (5=2) (6=2) INTO Wine_bottle. EXECUTE. VALUE LABELS Wine_bottle 1 "Small" 2 "Large". EXECUTE. RECODE Wine (1=1) (2=2) (3=3) (4=1) (5=2) (6=3) INTO Wine_glass. EXECUTE. VALUE LABELS Wine_glass 1 "Small" 2 "Medium" 3 "Large". EXECUTE. ***to code the area of the plate*** IF (Plate_size = 1) Plate_area=245.5. EXECUTE. IF (Plate_size = 2) Plate_area=415.5. EXECUTE. IF (Plate_size = 3) Plate_area=683.5. EXECUTE. VARIABLE LABELS Plate_area "the area of the plate in cm2". ***to code glass volume*** IF (Wine_glass = 1) Glass_volume=29. EXECUTE. IF (Wine_glass = 2) Glass_volume=35. EXECUTE. IF (Wine_glass = 3) Glass_volume=45. EXECUTE. VARIABLE LABELS Glass_volume "the volume of the glass in cl". ***Code to create a variable for the order in which the experiment was conducted. *code added by MP (Cambridge University - Sept 2020) STRING seq_rice_str (A7). COMPUTE seq_rice_str=rtrim(ltrim(STRING(Sequence_rice, F7))). STRING seq_wine_str (A7). COMPUTE seq_wine_str=rtrim(ltrim(STRING(Sequence_wine, F7))). EXECUTE. STRING seq_rice_1st (A1). STRING seq_rice_2nd (A1). STRING seq_rice_3rd (A1). STRING seq_rice_4th (A1). STRING seq_rice_5th (A1). STRING seq_rice_6th (A1). COMPUTE seq_rice_1st=CHAR.SUBSTR(seq_rice_str,1,1). COMPUTE seq_rice_2nd=CHAR.SUBSTR(seq_rice_str,2,1). COMPUTE seq_rice_3rd=CHAR.SUBSTR(seq_rice_str,3,1). COMPUTE seq_rice_4th=CHAR.SUBSTR(seq_rice_str,4,1). COMPUTE seq_rice_5th=CHAR.SUBSTR(seq_rice_str,5,1). COMPUTE seq_rice_6th=CHAR.SUBSTR(seq_rice_str,6,1). EXECUTE. ALTER TYPE PLATE seq_rice_1st seq_rice_2nd seq_rice_3rd seq_rice_4th seq_rice_5th seq_rice_6th (F1.0). COMPUTE time_rice=$SYSMIS. EXECUTE. IF Plate=seq_rice_1st time_rice=1. IF Plate=seq_rice_2nd time_rice=2. IF Plate=seq_rice_3rd time_rice=3. IF Plate=seq_rice_4th time_rice=4. IF Plate=seq_rice_5th time_rice=5. IF Plate=seq_rice_6th time_rice=6. EXECUTE. VARIABLE LEVEL time_rice (ORDINAL). DELETE VARIABLES seq_rice_1st seq_rice_2nd seq_rice_3rd seq_rice_4th seq_rice_5th seq_rice_6th. STRING seq_wine_1st (A1). STRING seq_wine_2nd (A1). STRING seq_wine_3rd (A1). STRING seq_wine_4th (A1). STRING seq_wine_5th (A1). STRING seq_wine_6th (A1). COMPUTE seq_wine_1st=CHAR.SUBSTR(seq_wine_str,1,1). COMPUTE seq_wine_2nd=CHAR.SUBSTR(seq_wine_str,2,1). COMPUTE seq_wine_3rd=CHAR.SUBSTR(seq_wine_str,3,1). COMPUTE seq_wine_4th=CHAR.SUBSTR(seq_wine_str,4,1). COMPUTE seq_wine_5th=CHAR.SUBSTR(seq_wine_str,5,1). COMPUTE seq_wine_6th=CHAR.SUBSTR(seq_wine_str,6,1). EXECUTE. ALTER TYPE WINE seq_wine_1st seq_wine_2nd seq_wine_3rd seq_wine_4th seq_wine_5th seq_wine_6th (F1.0). COMPUTE time_wine=$SYSMIS. EXECUTE. IF Plate=seq_wine_1st time_wine=1. IF Plate=seq_wine_2nd time_wine=2. IF Plate=seq_wine_3rd time_wine=3. IF Plate=seq_wine_4th time_wine=4. IF Plate=seq_wine_5th time_wine=5. IF Plate=seq_wine_6th time_wine=6. EXECUTE. VARIABLE LEVEL time_wine (ORDINAL). DELETE VARIABLES seq_wine_1st seq_wine_2nd seq_wine_3rd seq_wine_4th seq_wine_5th seq_wine_6th. VARIABLE LABELS time_wine (the position in which the each glass appeared in the order [out of 6]). VARIABLE LABELS time_rice (the position in which the each plate appeared in the order [out of 6]). ************************************************************************************************************************************************.