Book Image

Data Analysis with STATA

Book Image

Data Analysis with STATA

Overview of this book

Table of Contents (16 chapters)
Data Analysis with Stata
About the Author
About the Reviewers

Summarizing the data and preparing tabulated reports

Now, we will use the Fridge_sales data for further commands. For this, you need to inform Stata that you will be using Fridge_sales_data with the following command:

use fridge_sales_data

Now, in this data, the variables' volume denotes the volume of the fridge. How do you generate this variable in Stata? Your answer lies in using the summarize command:

summarize volume

The output of this command is as follows:

Now, you need to create a new variable called volume_ratio. The volume ratio denotes the fridge volume divided by 20:

generate volume_ratio = volume / 20

The generate command creates new variables in the given dataset. Similarly, for existing variables that need to be treated and made perfect for further analysis, you can use the replace command:

For example, take a look at the following:

replace volume = volume / 20

Now, you can see the changes between the original variable and the derived variable using the summarize command: