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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.