Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: coding for weighting factor variable -weight-
From
David Cefskimal <[email protected]>
To
[email protected]
Subject
Re: st: coding for weighting factor variable -weight-
Date
Wed, 1 Feb 2012 11:26:41 +0100
Steve, thank you. Yes, two samples were conducted, one for east
germany and one for west. I need to combine them and therefore weight
each one in this process of combining. I am looking into -collapse-
but I thought there is an even simpler way with weight in []. Thx!
On Tue, Jan 31, 2012 at 11:37 PM, Steve Samuels <[email protected]> wrote:
> I'm not sure that I understand your question completely, but I think that you want a weighted average of variables from two observations to be put into a single observation. If so, -collapse- provides a way.
>
> *************CODE BEGINS*************
> sysuse auto, clear
> keep in 1/2
> drop make
> gen part = _n //
> label define part 1 "West" 2 "East"
> label values part part
> list mpg weight length trunk part
>
> gen myweight = 1.23 if part==1
> replace myweight= 0.55 if part==2
> collapse mpg weight length trunk [pw =myweight]
> gen country ="Germany"
> list
> **************CODE ENDS**************
>
>
> By the way, "STATA" is not correct spelling of the program we all use, but "Stata" is. See the end of the Statalist FAQ for the reason.
>
> Steve
> [email protected]
>
>
> On Jan 31, 2012, at 3:36 PM, David Cefskimal wrote:
>
> Dear statlisters,
>
> I create a variable "Germany" but when the whole country is taken as
> the unit of analysis (rather than eastern and western states), a
> design weight is necessary: weighting factor for Western Germany:
> 1,23; weighting factor for Eastern Germany: 0,55.
>
> As the help weight command did not solve my problem, I would be v.
> thankful if someone could tell me how to code that in STATA. Many
> thanks, David
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/