Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: best way to create iweight - code?

From   Lisa Jahns <>
Subject   st: RE: RE: best way to create iweight - code?
Date   Thu, 13 Nov 2003 12:01:23 -0500

Dear Naji,
thank you for your helpful response, could you propose some coding to do this? for me the question is how to create the variable from the frequency and then how to attach to dataset B individuals. For instance:

dataset A
tab age gender, cell
egen pctA = ?, by (age gender)

Thank you very much for your help!



Make a cross tab (Age and Sex) for each dataset.
The cells are the % over the dataset

DatasetA 20-50 51-70
sex Male 25% 20%
Female 25% 30%

DatasetB 20-50 51-70
sex Male 20% 15%
Female 50% 15%

The weights are the ratio of % datasetB over % dataset A

WeightA 20-50 51-70
sex Male .8 .75
Female 2 .5

If one has a solution for more genral case (say 5 variables, some of the
cross cells are empty..)
thanks for sharing

-----Message d'origine-----
De :
[]De <> la part de Lisa Jahns
Envoyé : jeudi 13 novembre 2003 15:59
À :
Objet : st: best way to create iweight?

I have dataset "A" with some distribution of age (in years) and sex
(0,1), and totally unrelated dataset "B" with some different
distribution of age and sex. What is the most parsimonious way to
create an iweight for individuals in dataset B that will give it the
same age and sex distribution of dataset A?

Thank you,
Lisa Jahns
University of North Carolina

* For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index