Programming the statistical procedures from SAS

How to apply individual weights to get weighted n value..

Reply
Contributor
Posts: 28

How to apply individual weights to get weighted n value..

[ Edited ]

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!!

Super User
Posts: 5,099

Re: How to apply individual weights to get weighted n value..

[ Edited ]

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;

Contributor
Posts: 28

Re: How to apply individual weights to get weighted n value..

[ Edited ]

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

Contributor
Posts: 28

Re: How to apply individual weights to get weighted n value..

I would really appreciate if someone can help with this..
Ask a Question
Discussion stats
  • 3 replies
  • 188 views
  • 0 likes
  • 2 in conversation