Hi guys,
suppose to have the following dataset:
data DB;
input ID :$20. Comorbidity Total Class1 Class2 Class3 Class4 Class5 Class7;
cards;
0001 1 1.34 0.2 . . . . . .
0001 1 . . 0.5 . . . . .
0002 0 15 . . 1.2 . . . .
0003 1 2 . . . 0.5 . . .
;
run;
Is there a way to get the following?
data DB1;
input ID :$20. Comorbidity Total Class1 Class2 Class3 Class4 Class5 Class7;
cards;
0001 1 1.34 0.2 . . . . . .
0001 1 . . 0.5 0.64 . . . .
0002 0 15 . . 1.2 5 5 3.8 .
0003 1 2 . . . 0.5 1.5 . .
;
run;
In other words, the Total should be reached by adding values from the last filled class on -->.
Classes are age classes and values are persons-years. Total is the total a patient is in the study. So if a patient stay in the (age)class x a time y that does not cover the Total, additional person-years must be added from the age class x-->on because age can increase only. The reason why I need to fill with values is because the patient has not an event and this justify why Class* are empty but it is still at risk. Moreover each Class* cannot have values >5 because age classes are in a range of 5 years.
Thank you in advance.
... View more