Calculator – using an if statement

If statements can be useful tools in extracting information from a column or in reformatting data. Here, we will recode the values in the pulse worksheet.

In the pulse dataset, the C4 smokes column indicates if an individual is a smoker. 1 indicates a regular smoker and 2 stands for those who do not smoke. We will use an if statement to replace the numeric values for smokers and nonsmokers.

Getting ready

The data used here is one of the example files that come with Minitab. Open the pulse.mtw worksheet from the sample Minitab data folder by going to the File menu and clicking on Open Worksheet. Select the icon Look in Minitab Sample Data folder.

How to do it…

The following instructions will convert the values of ...

Get Minitab Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.