BookmarkSubscribeRSS Feed
ahhh
Obsidian | Level 7

Hi, I would really appreciate your help with this...

I have a dataset like this:

data one;
input id wt ;
datalines;
1 2.3
2 3.1
3 5.3
4 2.0
5 4.0
6 2.3
7 1.9
8 2.0
9 2.1
10 2.4
;
run;

 

The n of this dataset=10;

I need to get the weighted n value on this. weight variable is wt. There are no subgroups to use in proc surveyfreq.

How can I get the weighted n value?

 

Thanks in advance!!

3 REPLIES 3
Astounding
PROC Star

Well, it was over 40 years ago but I think the formula is just the wt value divided by the sum of all the wt values.  For example:

 

data want;

do until (done1);

   set have end=done1;

   total_weights + wt;

end;

do until (done2);

   set have end=done2;

   weighted_n = wt / total_weights;

   output;

end;

run;

ahhh
Obsidian | Level 7

May I phrased it incorrectly.
I need weighted n value- since n=10, I am expecting it to be something like this 13.23 ; around the number 10 but higher; And I have been advised to use proc surveyfreq for this...

ahhh
Obsidian | Level 7
I would really appreciate if someone can help with this..

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1614 views
  • 0 likes
  • 2 in conversation