BookmarkSubscribeRSS Feed
mantubiradar19
Quartz | Level 8

I'm working with BP data - where in they have measured SBP and DBP.

1. I have SBP and DBP measured twice as - SBP1 and SBP2

2. I have the data for SBP3 if - the difference between SBP1 and SBP2 is more than 10

3. I would like to calculate mean SBP using SBP1 and SBP2 if there is no data for SBP3

4. I would like to calculate mean SBP using SBP3 along with SBP2 or SBP1 - based which values (SBP1 or SBP2) are nearest to SBP3.

Can someone suggest me a code for this?

Thanks

 

OR

 

if SBP3 is missing then SBP = mean (SBP1, SBP2); else if the diff of SBP1 and SBP2 > 10 then use SBP3; SBP = Mean (SBP1 and SBP3) if abs(SBP3-SBP1) < (SBP2 and SBP3); SBP = Mean (SBP2 and SBP3) if abs(SBP2-SBP3) < (SBP1 and SBP3); run;

 

1 REPLY 1
PGStats
Opal | Level 21

Code is:

 

if missing(SBP3) 
	then SBP = mean(SBP1, SBP2);
else 
	if abs(SBP3-SBP1) < abs(SBP3-SBP2) 
		then SBP = mean(SBP1, SBP3);
	else SBP = mean(SBP2, SBP3);

(not tested)

PG

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 746 views
  • 2 likes
  • 2 in conversation