Demand Planning.Net: Are you Planning By Exception?
Demand Planning.Net
demand planning, forecasting, and exception management

Creating Weighted Statistics in SAS

Mark C Feb 20, 2004

I wanted to Proc means to calculate weighted statistics but the options seem too involved. In the specific example, you have hundred days that are zero and the remaining days have positive values where some of the zeros are not coded as zeros but simply the date is omitted. What is the average daily value?

If you computed an unweighted simple average, it will be misleading. It will overstate the mean since it will not weight the zeros. So the observed average needs to be multiplied by a proportion of number of non-zero days over total number of days. However the variance cannot be easily adjusted.

So in SAS, I created a row of zero and weighted it with 365-number of non zero rows. I created a weight of 1 for every non-zero row. If you use proc means and apply weighting option you are done. The mean is easy......... but the variance needs more work. You need to specify a variance deflator option to indicate you really want to use the total of weights to arrive at the variance.

This option is VARDEF=WEIGHT. See the example

weighted mean and variances using VARDEF option

Back to SAS Techniques

Consulting

Diagnostic |  DP Design |  Exception Management |  S&OP |  Solutions

Training

Demand Planning |  S&OP |  Retail Forecasting |  Supply Chain Analysis:  » Value Chain Metrics  » Inventory Optimization |  Supply Chain Collaboration

Industry

CPG/FMCG |  Food and Beverage |  Retail |  Pharma |  High Tech |  Other

Knowledge Base

Planning:  » Budgeting » S&OP |  Metrics: » Demand Metrics » Inventory  » Customer Service |  Collaboration:  » VMI & CMI » Account Based Forecasting
Forecasting:  » Causal Modeling  » Market Modeling  » Ship to Share |  For Students