Also btw....the misisng values issue is clearly delineated in the question "Grand Advisor" @Reeza😛
There are two ideas being discussed here.
1. The OP asked about a "weighted mean" of VARIABLES, but it seems what she really wants is a linear combination of six variables, where the coefficients change if one or more variables have missing values.
2. There were a few comments about using PROC EXPAND, which computes a moving average of OBSERVATIONS. I see no evidence that this is what the OP wants.
The reason I think that the OP wants (1) is because she mentions principal components.
Mila: The SUM function handles missing values, whereas the '+' operator propagates missing values. That is why someone suggested using SUM.
If you want to standardize the weights, just divide the sum by the sum of the weights, For example
y = sum(A1*x1, A2*x2, ..., A6*x6) / sum(A1, A2, ..., A6);
See the article "Compute a weighted mean in SAS."
Thank you very much, this helps clear things up tremendously - best wishes
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.