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 ;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: