Hi, I am one step away from novice to SAS, and I am stuck coding a specific variable. There are around 300 study participant IDs. I am looking at rejection biopsy grades at 52, 104, 156, 208, and 260 weeks (tt_bx#) after surgery with an interval of +/- 13.035 weeks. Each ID has a maximum of 10 biopsies (bx_1, bx_2, bx_3, bx_4, etc.), and I have calculated the time to each biopsy from surgery. The issue is some ID's have multiple biopsies that are within the 52 +/- 13.035wks interval, and subsequent time frames. How do I code SAS to choose the bx_# that is closest to the central value within the time frame? Here is the code I have so far, which works only if there was only one biopsy grade per 52 weeks. I am trying to code the new variable acr_1yr in this example. data work.cleaning;
set work.cleaning;
**Biopsy 1 Year***
**ACR**;
if tt_bx1>=39.108 and tt_bx1<=65.178 then acr_1yr=bx1_acr;
if tt_bx2>=39.108 and tt_bx2<=65.178 then acr_1yr=bx2_acr;
if tt_bx3>=39.108 and tt_bx3<=65.178 then acr_1yr=bx3_acr;
if tt_bx4>=39.108 and tt_bx4<=65.178 then acr_1yr=bx4_acr;
if tt_bx5>=39.108 and tt_bx5<=65.178 then acr_1yr=bx5_acr;
if tt_bx6>=39.108 and tt_bx6<=65.178 then acr_1yr=bx6_acr;
if tt_bx7>=39.108 and tt_bx7<=65.178 then acr_1yr=bx7_acr;
if tt_bx8>=39.108 and tt_bx8<=65.178 then acr_1yr=bx8_acr;
if tt_bx9>=39.108 and tt_bx9<=65.178 then acr_1yr=bx9_acr;
if tt_bx10>=39.108 and tt_bx10<=65.178 then acr_1yr=bx10_acr;
run;
Any help would be appreciated.
... View more