|
Thanks Yu for your answer.....gave me a good start....i could not find
much info from documentation......okay from your answer, usage of var
statement is needed as the requested analysis variables are sum and
mean....two ways i could think of, but dont know which one is
right....hope to get some help....
*******method 1 with var and weight statement;
proc tabulate data = one missing ;
class popu type mos ;
var anal1 ;
weight weighted_anal1 ; ********weighted_anal1 = wgt * anal1;
tables popu * type , mos*anal1 *(sumwgt = 'Sum' mean = 'Mean') ;
title4 "Weighted tabulate run for population*type*mos" ;
run ;
********method 2 with var but no weight statement;
proc tabulate data = one missing ;
class popu type mos ;
var weighted_anal1 ; ********weighted_anal1 = wgt * anal1;
tables popu * type , mos*weighted_anal1 *(sumwgt = 'Sum' mean = 'Mean') ;
title4 "Weighted tabulate run for population*type*mos" ;
run ;
many thanks
hari.
On Wed, 27 Feb 2008 12:48:16 -0600, Yu Zhang <zhangyu05@GMAIL.COM> wrote:
>Hi, Hari,
>
>You may try to create a new variable in your report dataset, say
>weighted_anal1=wgt*anal1.
>then in proc tabulate,
>
> proc tabulate data = one missing ;
> class popu type mos ;
> weight wgt ;
> tables popu * type , mos*(sumwgt = 'Sum' mean = 'Mean') ;
> title4 "Weighted tabulate run for population*type*mos" ;
>run ;
>
>I didn't test it with mock data. But the online doc says:
> SUMWGT
>
>is the sum of the weights, Wi, computed as: sigma Wi.
>
>HTH
>
>Yu
>
>
>
>On Wed, Feb 27, 2008 at 11:17 AM, Hari Nath <hari_s_nath@yahoo.com> wrote:
>
>> Hi all,
>>
>> Normally i use weights for counts and most of time in proc
summary....but
>> now i need some help in figuring out to weight the sum and means in proc
>> tabulate.....the 'wgt' variable is the weight and it is an integer
created
>> based on 'type' variable....can someone correct me with the right way of
>> weighting here.......i looked at the archives and one example had to
>> multiply the weight variable somthing like
>> tables (popu*type)*wgt*sumwgt, mos*anal1 *(sum = 'Sum' mean = 'Mean') ;
>>
>> which doesnt work for me.......
>>
>> many thanks
>> hari.
>>
>> ********my code;
>> proc tabulate data = one missing ;
>> class popu type mos ;
>> var anal1 ;
>> weight wgt ;
>> tables popu * type , mos*anal1 *(sum = 'Sum' mean = 'Mean') ;
>> title4 "Weighted tabulate run for population*type*mos" ;
>> run ;
>>
|