BookmarkSubscribeRSS Feed
sas_new_user
Calcite | Level 5

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.

3 REPLIES 3
Ksharp
Super User

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

ballardw
Super User

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).

Ksharp
Super User

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1459 views
  • 0 likes
  • 3 in conversation