Hello programmers,
How can i use the lag function to print out patients that have 15% or more reduction in systolic BP and 8% or more reduction in diastolic BP between visits 1 and 5.
Thanks!
DATA five;
SET four;
lag_systolic = lag(systolic);
dif_systolic = systolic - lag_systolic;
per_incr_sys = (dif_systolic/lag_systolic)*100;
RUN;
proc print; run;
data six;
set five;
lag_diastolic = lag(diastolic);
dif_diastolic= diastolic- lag_diastolic;
per_incr_dia = (dif_diastolic/lag_diastolic)*100;
run;
proc print; run;
data seven;
set six;
if per_incr_sys =< -15 and per_incr_dia =<-8 then output;
run;
proc print; run;
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.