7. Part V: Modifying your data
Normally when we collect data, we don’t get everything in the format that we actually want to analyse. For example, in a survey we often collect information about height and weight – but what we really want to know is their body mass index (BMI). We use the height and weight data to calculate this, and create a new variable BMI. We might then also want to categorise our new BMI variable into: underweight, normal weight, overweight & obese.
We’re now going to look at a couple of very commonly used commands to modify, and create new variables from, existing data.
Key commands to modify your data:
You can access these procedures from the menus, under the Transform menu. There are many things you can do here, such as create standardised variables (with a mean of 0, SD of 1), create new variables from ntiles (tertiles, quartiles, quintiles, deciles, etc.), and many more. It’s worth having a look to see what you can do.
The compute and recode commands can be used for simple data modification processes, though, so we’ll write the code ourselves in our syntax file.