DATA Step, Macro, Functions and more

Average of two columns while retaining all variables in data set

Reply
Occasional Contributor
Posts: 7

Average of two columns while retaining all variables in data set

I have to columns. One is the Center and the other is diastolic blood pressure reading. How to i compute the average diastolic blood pressure for each center while retaining all other variables in the data set.

PROC Star
Posts: 1,580

Re: Average of two columns while retaining all variables in data set

Posted in reply to marianthi86

Can you please post a sample of what you HAVE and what you WANT?

Occasional Contributor
Posts: 7

Re: Average of two columns while retaining all variables in data set

Posted in reply to novinosrin
I have 6 variables in my data set:
patient visit center treat dbp dbp1


Center is a group variable and dbp is a numeric variable.

I want to calculate the mean dbp for each center by creating a new column
that includes observations for the mean dbp of each center without having
to create a new data set. I want to retain all other observations for other
columns.

Respected Advisor
Posts: 2,825

Re: Average of two columns while retaining all variables in data set

[ Edited ]
Posted in reply to marianthi86

Really, you could show us some example of your data, and an example of the results you want, so we can truly understand what you are asking for. Without that, we are merely guessing, and possibly wasting evereyone's time.

 

Here's my guess:

Use PROC SUMMARY with center in the CLASS statement, then merge the results into the original data set.

 

If that's the answer, great.

 

If not, DO NOT REPLY that this doesn't work without showing us an exaample of your data and the desired result.

--
Paige Miller
Ask a Question
Discussion stats
  • 3 replies
  • 93 views
  • 1 like
  • 3 in conversation