Dear all,
here is my data set:
A B C
1 3 120
1 6 110
1 9 140
2 3 110
2 6 105
3 3 118
4 3 160
4 6 170
4 9 180
4 12 110
A is ID, B is month, C is systolic blood pressure. I want to average blood pressure for each ID. Is there a simple way?
Thanks,
Xinjian
proc sql;
select a as id,avg(c) as average_blood_pressure format=8.2 from have
group by a;
quit;
I would use the MEANS procedure with a class variable:
proc means data=have mean nway noprint;
var C;
class A;
output out=want (drop=_TYPE_ _FREQ_)
mean=Avg_Blood_Pressure;
run;
Hope this helps!
proc sql;
select a as id,avg(c) as average_blood_pressure format=8.2 from have
group by a;
quit;
I really appreciate your help.
Also, thank you, dcruik, for your quick response, and different version to solve this problem.
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.