Hi,
I have eGFR data with multiple eGFR values per patient. And I want to select the eGFR value closest to diagnosis date (+-2 months). And for patients with multiple values in +-2 months period I want to select the eGFR value prior to diagnosis and closest to diagnosis date. I am not able to write the code for the "elect the eGFR value prior to diagnosis and closest to diagnosis ". Appreciate any help I can get.
Here is the code I have so far:
data Y;
set X;
CalCreDiff=eGFRdate-DX_DATE;
AbsCaleGFRDiff=abs(CalCreDiff);
if -60<=AbseCaleGFRDiff=<60;
run;
The code you are attempting is about 2 lines longer than it needs to be. Unless you later that need one or more of the AbsCaleGFRDiff or CalCreDiff variables then do the arithmetic inside the ABS function.
Also you only need one side for the comparison.
data example; input x y; if abs(x - y) le 60 then put "Between -60 and 60"; else put "Out of range"; datalines; 120 60 120 59 120 61 0 -61 0 -60 0 -59 ;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.