Hello everyone, I am calculating risk differences with the lag function, I have a variable exposure category (with 3 exposure levels), I want to calculate the difference based on the reference category, but I have not succeeded, any suggestions? help please. I am using this code, there is no problem for the difference between category 2 with the reference, but the calculation of the third category is no longer done with the reference, rather with the previous category (which I understand is what happens with the lag function) is there any way to set a reference category? data test; set test; by time exposure; rd = risk - lag(risk); rr = risk / lag(risk); if first.time then rd=.; if first.time then rr=.; run;
... View more