Syntax, DELETE statement:
DELETE;
To conditionally execute
a DELETE statement, use the following syntax for an IF statement:
IF expression THEN
DELETE;
The expression is evaluated
as follows:
|
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;
if resthr<70 then delete;
TotalTime=(timemin*60)+timesec;
retain SumSec 5400;
sumsec+totaltime;
length TestLength $ 6;
if totaltime>800 then testlength='Long';
else if 750<=totaltime<=800 then testlength='Normal';
else if totaltime<750 then TestLength='Short';
run;
Syntax, DROP=, and KEEP=
data set options:
(DROP=variable(s))
(KEEP=variable(s))
|
data clinic.stress(drop=timemin timesec);
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;
if tolerance='D';
TotalTime=(timemin*60)+timesec;
retain SumSec 5400;
sumsec+totaltime;
length TestLength $ 6;
if totaltime>800 then testlength='Long';
else if 750<=totaltime<=800 then testlength='Normal';
else if totaltime<750 then TestLength='Short';
run;
Syntax, DROP, and KEEP
statements:
DROP variable(s);
KEEP variable(s);
|
data clinic.stress(drop=timemin timesec); 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; if tolerance='D'; TotalTime=(timemin*60)+timesec; retain SumSec 5400; sumsec+totaltime; length TestLength $ 6; if totaltime>800 then testlength='Long'; else if 750<=totaltime<=800 then testlength='Normal'; else if totaltime<750 then TestLength='Short'; run; 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; if tolerance='D'; drop timemin timesec; TotalTime=(timemin*60)+timesec; retain SumSec 5400; sumsec+totaltime; length TestLength $ 6; if totaltime>800 then testlength='Long'; else if 750<=totaltime<=800 then testlength='Normal'; else if totaltime<750 then TestLength='Short'; run;