* Encoding: UTF-8.
* Encoding: .

*********************************The Impact of Health Warning Labels on Snack Selection: Study Two******************************************

***This syntax will recode the raw data for the food labelling study two 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 08/05/2019
***The syntax was checked and edited by Natasha Clarke (Cambridge Univeristy) on 12/05/2019

***to read this file you will need the files: FoodLabellingStudy_DataDictionary_v1.0_20190424 and FoodLabellingStudy_SAP _v2.0_20190306
*HWL (health warning label)

***bring raw data into SPSS from Excel (use your own file name)***

GET DATA
  /TYPE=XLSX
  /FILE='C:\Users\kdelo\Desktop\WFH\Snack study 2\1. Raw data\Original data DO NOT '+
    'TOUCH\FoodLabellingStudy_OriginalDatabase_v1.0_20190508.xlsx'
  /SHEET=name 'Downloaded dataset numeric valu'
  /CELLRANGE=FULL
  /READNAMES=ON
  /DATATYPEMIN PERCENTAGE=95.0
  /HIDDEN IGNORE=YES.
EXECUTE.
DATASET NAME DataSet1 WINDOW=FRONT.

***labelling of categorical variables as per the data dictionary***************************************************************

VALUE LABELS Condition
1 "pictorial HWL with calories"
2 " text-only HWL with calories"
3 "calories only"
4 "Pictorial HWL"
5 "Text-only HWL"
6 "Control (no label)".
EXECUTE.

VALUE LABELS Primaryoutcome
0 "low energy-dense"
1 "high energy-dense".
EXECUTE.

VALUE LABELS Snackselectedprimaryoutcome
1 "doritios"
2 "apple crisps"
3 "galaxy"
4 "Nims beetroot crisps"
5 "muller yoghurt"
6 "mccoys"
7 "apple and grapes fruit"
8 "millionaire shortbread"
9 "dairy milk"
10 "mango and pineapple fruit"
11 "GU dessert"
12 "KIND bar".
EXECUTE.

VALUE LABELS Acceptabilitycondition
1 "pictorial HWL with calories"
2 "text-only HWL with calories"
3 "calories only"
4 "Pictorial HWL"
5 "Text-only HWL".
EXECUTE.

VALUE LABELS Timemanipulationcondition
1 "time pressure"
2 "no time pressure".
EXECUTE.

VALUE LABELS Gender
1 "Male"
2 "Female"
3 "Other"
4 "Prefer not to say".
EXECUTE.

VALUE LABELS Ethnicity
1 "White"
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 BMIcategory
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+)".
EXECUTE.

VALUE LABELS Education
1 "None"
2 "Up to 4 GCSEs (Including 1-4 O Levels/CSE/GCSEs (any grades), Foundation Diploma, NVQ level 1, Foundation GNVQ 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.

AUTORECODE VARIABLES=Income 
  /INTO Income_autorecode
  /BLANK=MISSING
  /PRINT.

VALUE LABELS Income_autorecode
1 "A"
2 "B"
3 "C"
4 "D"
5 "E"
6 "F"
7 "G"
8 "H"
9 "I"
10 "J"
11 "K"
12 "L"
13 "M"
14 "N"
15 "O"
16 "Rather not say".
EXECUTE.

VALUE LABELS Snackconsumptionfrequency
1 "daily"
2 "weekly"
3 "monthly"
4 "never".
EXECUTE.

VALUE LABELS Biscuitsandcookies Cakesmuffinsandpastries Chocolatebarsorotherchocolatebasedsnackse.g.packofmampms Sweetse.g.bagofskittlespacketoffruitpastilles Packetsofcrisps
1 "less than once a week"
2 "once a week"
3 "2-3 times a week"
4 "4-6 times a week"
5 "everyday".
EXECUTE.

***creating new variables for reporting purposes only (table 1)***

*Ethnicity*

RECODE Ethnicity (1=0) (2 thru 5=1) (ELSE=Copy) INTO Ethnicitydichotomised.
VARIABLE LABELS  Ethnicitydichotomised 'Ethnicity dichotomised'.
EXECUTE.

VALUE LABELS Ethnicitydichotomised
0 "White"
1 “Non-White”
-888 "Prefer not to say".
EXECUTE.

*Education*

RECODE Education (1=0) (2=0) (3=0) (4=0) (5=1) (6=1) (7=1) (ELSE=Copy) INTO 
    Highestqualificationsplit01.
VARIABLE LABELS  Highestqualificationsplit01 'Highest qualification split01'.
EXECUTE.

VALUE LABELS Highestqualificationsplit01
0 "no Bachelor's degree"
1 "Bachelor's degree or higher".
EXECUTE.

*Income*

RECODE Income_autorecode (1 thru 10=0) (11 thru 15=1) (ELSE=Copy) INTO Income_split.
VARIABLE LABELS  Income_split 'Income split by 11th (k)'.
EXECUTE.

VALUE LABELS Income_split
0 "income below the median 11th category"
1 "income is the 11th category or higher".
EXECUTE.

***To make variables for primary outcome analysis

*to make a HWL group variable*

COMPUTE HWL.
If (Condition = 1) HWL = 1.
If (Condition = 2) HWL = 0.
if (Condition = 3) HWL = 2.
If (Condition = 4) HWL = 1.
If (Condition = 5) HWL = 0.
If (Condition = 6) HWL = 2.
EXECUTE.

Value labels HWL
2 "no HWL label"
1 "pictorial present"
0 "text only (no pictorial) present".
EXECUTE.

*to make a calorie variable*

Compute Calories.
If Condition = 1 Calories = 0.
If Condition = 2 Calories = 0.
If Condition = 3 Calories = 0.
If Condition = 4 Calories = 1.
If Condition = 5 Calories = 1.
If Condition = 6 Calories = 1.

VALUE LABELS Calories
1 "no calorie information"
0 "calorie information".
EXECUTE.

***To make variables for Secondary outcome (A) analysis (acceptability)

*to make a HWL group variable*

COMPUTE HWLAcceptability.
If Acceptabilitycondition = 1 HWLAcceptability = 1.
If Acceptabilitycondition = 2 HWLAcceptability = 0.
if Acceptabilitycondition = 3 HWLAcceptability = 2.
If Acceptabilitycondition = 4 HWLAcceptability = 1.
If Acceptabilitycondition = 5 HWLAcceptability = 0.
EXECUTE.

Value labels HWLAcceptability
2 "no HWL label"
1 "pictorial present"
0 "text only (no pictorial) present".
EXECUTE.

*to make a calorie variable*

Compute CalorieAcceptability.
If Acceptabilitycondition = 1 CalorieAcceptability = 0.
If Acceptabilitycondition = 2 CalorieAcceptability = 0.
If Acceptabilitycondition = 3 CalorieAcceptability = 0.
If Acceptabilitycondition = 4 CalorieAcceptability = 1.
If Acceptabilitycondition = 5 CalorieAcceptability = 1.

VALUE LABELS CalorieAcceptability
1 "no calorie information"
0 "calorie information".
EXECUTE.

**There are 4134 participants for analysis. NO EXCLUSIONS***