Hi,
How can I add second proc univariate to this:
proc univariate data=set_out;
by date;
weight w1;
VAR price;
run;
I want to obtain wieghted mean by group variable, using w2 as wieght.
@ab97_cd wrote:
Hi,
How can I add second proc univariate to this:
proc univariate data=set_out; by date; weight w1; VAR price; run;
I want to obtain wieghted mean by group variable, using w2 as wieght.
I'm sorry this just isn't clear to me. You can certainly add a second PROC UNIVARIATE to your code, so I'm not sure what your question really is.
If all you want is weighted means, use PROC SUMMARY and not PROC UNIVARIATE.
If you have a complex weighting (sampling) design then you probably will need to use PROCSURVEYMEANS instead of UNIVARIATE or MEANS.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.