Value for TotalTime
|
Resulting Value for
TestLength
|
---|---|
greater than 800
|
Long
|
750 - 800
|
Normal
|
less than 750
|
Short
|
Syntax, IF-THEN statement:
IF expression THEN statement;
|
data clinic.stress;
infile tests;
input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33
RecHR 35-37 TimeMin 39-40 TimeSec 42-43
Tolerance $ 45;
TotalTime=(timemin*60)+timesec;
retain SumSec 5400;
sumsec+totaltime;
if totaltime>800 then TestLength='Long';
run;
Operator
|
Comparison Operation
|
---|---|
= or
eq
|
equal to
|
^= or ~= or
ne
|
not equal to
|
> or
gt
|
greater than
|
< or
lt
|
less than
|
>= or
ge
|
greater than or equal
to
|
<= or
le
|
less than or equal to
|
in
|
equal to one of a list
|
if test<85 and time<=20 then Status='RETEST'; if region in ('NE','NW','SW') then Rate=fee-25; if target gt 300 or sales ge 50000 then Bonus=salary*.05;
Operator
|
Logical Operation
|
---|---|
&
|
and
|
|
|
or
|
^ or ~
|
not
|
if status='OK' and type=3 then Count+1; if (age^=agecheck | time^=3) & error=1 then Test=1;
if (age^=agecheck | time^=3) & error=1 then Test=1; if status='S' or cond='E' then Control='Stop';
if not(loghours<7500) then Schedule='Quarterly'; if region not in ('NE','SE') then Bonus=200;
if status='OK' and type=3 then Count+1; if status='S' or cond='E' then Control='Stop'; if not(loghours<7500) then Schedule='Quarterly'; if region not in ('NE','SE') then Bonus=200;
if x=1 or 2;
if x=1 or x=2;
if totaltime>800 then TestLength='Long'; if 750<=totaltime<=800 then TestLength='Normal'; if totaltime<750 then TestLength='Short';
if totaltime>800 then TestLength='Long'; else if 750<=totaltime<=800 then TestLength='Normal'; else if totaltime<750 then TestLength='Short';
Syntax, ELSE statement:
ELSE statement;
|
data clinic.stress; infile tests; input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33 RecHR 35-37 TimeMin 39-40 TimeSec 42-43 Tolerance $ 45; TotalTime=(timemin*60)+timesec; retain SumSec 5400; sumsec+totaltime; if totaltime>800 then TestLeng h='Long'; else if 750<=totaltime<=800 then TestLength='Normal'; else if totaltime<750 then TestLength='Short'; run;
if totaltime>800 then TestLength='Long';
else if 750<=totaltime<=800 then TestLength='Normal';
else put 'NOTE: Check this Length: ' totaltime=;
run;