Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Re: coding


From   "Alexander Nervedi" <[email protected]>
To   [email protected]
Subject   RE: st: Re: coding
Date   Sat, 28 Jan 2006 02:24:19 +0000

thats a great solution. I now have to figure out. All i need to do is figure out how to get the formatting to show leading zeros!

thanks Michael



From: "Michael Blasnik" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: Re: coding
Date: Fri, 27 Jan 2006 20:16:37 -0500

I'm not sure I understand, but if you want to create a single categorical variable for each case based on 8 years of data and you have a categorical variable that takes on one of three possible values (possibility=1,2,3) for each year (year= 1,2,3,4,5,6,7,8), then you could::

gen score=possibility*10^(year-1)
collapse (sum) score, by(caseid)

This will give you an 8 digit number (score) for each caseid with each digit representing the value of possibility for each year. One advatage of this approach is that the resulting number can be directly interpreted. If you had more years than you might need to create the score variable as a double.

Michael Blasnik
[email protected]

----- Original Message ----- From: "Alexander Nervedi" <[email protected]>
To: <[email protected]>
Sent: Friday, January 27, 2006 7:30 PM
Subject: st: coding



Hi List users,

I am having a tough time getting my head around this.

I have data on households which goes for 8 years and in each year i can observe 3 possibilities. Thus a total of 8^3 possible histories exist.

How would I go about creating a variable that classifies the data into each of these possibilities?

I have 800 households that I need to classify in this form.

thanks!

Al
*
*   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/
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

*
* 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