Help using Base SAS procedures

Centering variables

Accepted Solution Solved
Reply
Contributor
Posts: 71
Accepted Solution

Centering variables

Could I get some help on how to create centered values of variables in a dataset? In the attached example I'd like to calculate the grand mean for score1 and score2 and then subtract each value of score1 and score2 from their corresponding grand mean. I need to do this on a grand scale for many variables so I suppose it's an exercise in how to merge the raw data with the grand means of each variable. Or, is there a statistical procedure that can do it?

Thanks!!

Attachment

Accepted Solutions
Solution
‎10-06-2014 02:42 AM
Super User
Posts: 19,876

Re: Centering variables

There's a proc for that :-), Look up proc standardize and stdize

Edit: in your case you want stdize with method= mean.

View solution in original post


All Replies
Super Contributor
Posts: 298

Re: Centering variables

This can be easily done using double do-loops. No procedure is needed. It is just adding the values of the variable with simultaneous count in the first do-loop and finding the deviations

from the mean in the second do-loop.

I am unable to read your attached data set because of version difference. If you are interested, show a sample data in a readable form like datalines.

Best of luck.

Muthia Kachirayan

Solution
‎10-06-2014 02:42 AM
Super User
Posts: 19,876

Re: Centering variables

There's a proc for that :-), Look up proc standardize and stdize

Edit: in your case you want stdize with method= mean.

Contributor
Posts: 71

Re: Centering variables

Thank you Reeza, saved me a lot of time!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 1617 views
  • 3 likes
  • 3 in conversation