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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 1380 views
  • 0 likes
  • 2 in conversation