Hello,
I am applying weight statement at proc summary below.
However, it did not bring the weighted count.
I am wondering how this can work. Thanks.
(Just use proc summary , no proc freq).
proc summary data=a1 chartype completetypes;
class treatment;
types treatment;
weight IPW; /*weight dose not work?*/
output out=ae_1;
quit;
If your IPW variable is a count then you likely mean to use FREQ not Weight statement.
proc summary data=a1 chartype completetypes; class treatment; types treatment; Freq IPW; output out=ae_1; quit;
Freq uses the variable as a count of records where all the variables are the same.(or at least the one you are using for other statements in the procedure).
Weight will not change the sample size the way Freq does.
However, it did not bring the weighted count.
You can compute the sumwgt statistic.
proc summary data=a1 chartype;
class treatment;
weight IPW;
output out=ae_1 sumwgt=sum_weights /* Other statistics required go here */;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.