How to create values of a new variable based on conditions met by other variables

How to create values of a new variable based on conditions met by other variables

book

Article ID: KB0081799

calendar_today

Updated On:

Products Versions
Spotfire Statistica 12.7 and above

Description

How to create values of a new variable based on conditions met by other variables.
 

Issue/Introduction

How to create values of a new variable based on conditions met by other variables

Resolution

Use either of the data transformation facilities: spreadsheet formulas or Statistica Visual Basic. However, often the quickest way to create values of a new variable based on conditions met by other variables is to use the data recoding facility under Data tab. Note that the currently selected variable does not have to be included in the text of the recoding conditions. Thus, use this facility to create values of a variable based on conditions met by other variables.

For example, add a new (empty) variable to the data file, and then use this facility to create the new values. For instance, the recoding conditions could be used to assign 1s to the new variable for all "male subjects 18 to 25 years old with cholesterol levels below 200," 2s to "male subjects 18 to 25 years old with cholesterol levels above 200," and assign the missing data value to all other subjects.