The If() function evaluates the first result expression when its condition evaluates as true (a nonzero or nonmissing value). Otherwise, it evaluates the second result expression.
If ( condition, result1, result2 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
For Each Row( age = If( :age < 12, "Young", "Young at Heart" ) );
If( condition1, result1,
	condition2, result2,
	...,
	resultElse );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
For Each Row( sex =
	If(
		sex == "F", "Female",
		sex == "M", "Male",
		"Unknown" );
);
For Each Row( sex =
For each row in the table, sex is the column that is recoded.
If(
Begins the If() loop.
	sex == "F", "Female",
If the value of sex is F, replaces the value with Female.
	sex == "M", "Male",
If the value of sex is M, replaces the value with Male.
	"Unknown" );
);
y = 25;
z = If( y < 20, x = y, x = 20 );
Note: Be careful to use two equal signs (==) for equality tests, not one equal sign (=). An If with an argument such as name=value assigns rather than tests the value.

Help created on 9/19/2017