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

Re: st: tranforming a dataset


From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   Re: st: tranforming a dataset
Date   Fri, 2 Jan 2004 18:54:08 -0000

That was quite helpful. Thanks Danielle 

----- Original Message ----- 
From: "Danielle H.Ferry" <[email protected]>
To: <[email protected]>
Sent: Friday, January 02, 2004 6:02 PM
Subject: Re: st: tranforming a dataset


> see <reshape>
> 
> On Jan 2, 2004, at 12:51 PM, R.E. De Hoyos wrote:
> 
> > The problem is a simple one.
> >
> > I have a household survey with income information.
> >
> > Every household member who receives a positive income is part of this
> > dataset. Every households in the survey has
> > a unique identification number (folio) and within each household every
> > member has a "position number". If a household member has more than two
> > income sources then he or she will have more than one observations in 
> > the
> > dataset. The data is presented in the following way:
> >
> > Folio  Position   Income Source   Monthly Income
> > 1        1                S1                            $1000
> > 1        1                S2                            $2000
> > 1        2                S1                            $800
> > 1        3                S5                            $900
> > 2        1                S1                            $2500
> > 2        2                S3                            $750
> >
> > In this way the first household (folio 1) has 3 members and the head
> > (position 1) has two income sources, the second one just one, etc.
> >
> > What I want to do is to transform the data in such a way that the 
> > different
> > income sources represent a different variable in the dataset.
> >
> > Folio  Position    Monthly Income  S1            S2    ...
> > 1        1                        $1000       $1000       $0
> > 1        1                        $2000       $0             $2000
> > 1        2                        $800         $800         $0
> > 1        3                        $900         $0             $0
> > 2        1                        $2500       $2500       $0
> > 2        2                        $750         $0             $0
> >
> > I tried using the tabulate command combined with generate using the 
> > "Income
> > Source" variable to get dummies for each of the income sources and then
> > interact this with "Monthly Income", the problem is that I want to 
> > preserve
> > the original code (name) given by the "Income Source" variable (this is
> > because the different income sources are not following a numeric 
> > order).
> >
> > Do you have any suggestion?
> >
> > Many thanks
> > Rafa
> > *
> > *   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/
> >
> 
> *
> *   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/
> 
*
*   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/



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