Date: Wed, 27 Feb 2008 12:48:16 -0600
Reply-To: Yu Zhang <zhangyu05@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yu Zhang <zhangyu05@GMAIL.COM>
Subject: Re: weights in tabulate
In-Reply-To: <445d9dbe0802271047y3d7bc996n8b6e2a726827909b@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
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 ;
>
|