Returns a character value based on whether an expression is true, false, or missing.
| Category: | Character |
| Restriction: | I18N Level 2 functions are designed for use with SBCS, DBCS, and MBCS (UTF8). |
specifies a numeric constant, variable, or expression.
specifies a character constant, variable, or expression that is returned when the value of logical-expression is true.
specifies a character constant, variable, or expression that is returned when the value of logical-expression is false.
grade>80 to
implement the logic that determines the performance of several members
on a team. The results are written to the SAS log.data _null_; input name $ grade; performance = ifc(grade>80, 'Pass ', 'Needs Improvement'); put name= performance=; datalines; John 74 Kareem 89 Kati 100 Maria 92 ; run;
name=John performance=Needs Improvement name=Kareem performance=Pass name=Kati performance=Pass name=Maria performance=Pass
data _null_;
input name $ grade;
if grade>80 then performance='Pass ';
else performance = 'Needs Improvement';
put name= performance=;
datalines;
John 74
Sam 89
Kati 100
Maria 92
;
run;