turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Variance of a weighted sum

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-13-2012 03:10 AM

Hi folks,

Can anybody shed some insight on the procedure to use for calculating the variance of a weighted sum? Basically what I'm looking for is SAS 9.3 code to calculate var(z) in the following equation:

var(z) = a^2[var(x)] + b^2[var(y)]

a&b are the weights, x&y are the variables for which variance is to be calculated. More information can be provided if necessary.

Thanks in advance for considering.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-13-2012 11:14 PM

proc means , proc summary ,proc univariate ........... can do it.

proc means data=sashelp.class nway noprint; class sex; var height; weight age; output out=want var=height_weight_var ; run;

Ksharp

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-14-2012 12:13 PM

To use two different weights you will need to make a pass through means for each weight variable.

Then combine the two resulting data sets to calculate your var( Z).

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-14-2012 10:39 PM

Ou. Sorry ! I misunderstood what op mean. I even don't notice there are two variables being the weight.