IF your starting data does not have more than one observation when you have that Param=ECG and Not done values then something like this should suffice:
data want;
set have;
if Param='ECG' and Val='Not done' then do;
Param='Heart rate'; output;
Param='QT interval'; output;
Param='QRS duration'; output;
end; else output;
run;
The OUTPUT statement tells SAS to write to the output destination when encountered. If change the value of one variable, such as Param, all the others stay the same and are written to the output such as the Subjid, Visit, Value and Rsn
Since you want to write 3 values then 3 outputs.
However, if you have other stuff for day 35, because you didn't show the next observations, then this may not be quite correct.
... View more