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

 From Lisa Jahns To statalist@hsphsun2.harvard.edu 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!

Lisa

Lisa,

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

Regards
Naji
-----Message d'origine-----
De : owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]De <mailto:owner-statalist@hsphsun2.harvard.edu%5DDe> la part de Lisa Jahns
Envoyé : jeudi 13 novembre 2003 15:59
À : statalist@hsphsun2.harvard.edu
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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/