BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
xinjian
Calcite | Level 5


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

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

proc sql;

select a as id,avg(c) as average_blood_pressure format=8.2 from have

group by a;

quit;

View solution in original post

3 REPLIES 3
dcruik
Lapis Lazuli | Level 10

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!

stat_sas
Ammonite | Level 13

proc sql;

select a as id,avg(c) as average_blood_pressure format=8.2 from have

group by a;

quit;

xinjian
Calcite | Level 5

I really appreciate your help.

Also, thank you, dcruik, for your quick response, and different version to solve this problem.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 553 views
  • 0 likes
  • 3 in conversation