Bookmark and Share

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: one data management question


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: one data management question
Date   Sat, 5 Mar 2011 19:32:25 +0000

This looks like fake data intended to show the flavour of your problem.

Thanks, but I think a solution would be easier if you showed real data.

Nick

2011/3/5 Grace Jessie <[email protected]>:

> I have a data like the following with only one variable---var.
>
>     +-------+
>     |   var |
>     |-------|
>  1. | areaA |
>  2. |     1 |
>  3. |   hot |
>  4. |     3 |
>  5. |     4 |
>     |-------|
>  6. |     2 |
>  7. |  cold |
>  8. |     4 |
>  9. | areaB |
>  10. |     1 |
>     |-------|
>  11. |  warm |
>  12. |     6 |
>  13. |     2 |
>  14. | rainy |
>     +-------+
> There are some areas and some big portfolios within each area in the data. The number of observations for each porfolio varies and the max is 4. If the observation number for each portfolio equals 4, the 4 observations represent id weather x y,respectively and orderly.If the number is less than 4, such as 3, it says the last observation for y is missing.The indicative string is "hot cold warm rainy" which is used to distinguish each portfolio. Each portfolio begins from the observation one before "hot cold warm rainy" and ends one before another portfolio begins.For example, there are two porfolios in areaA. One is "1 hot 3 4", and the other is "2 code 4".
> Now I want to change the data to another one available for regression as follows.
>
>     +-----------------------------+
>     | area   id   weather   x   y |
>     |-----------------------------|
>  1. |    A    1       hot   3   4 |
>  2. |    A    2      cold   4     |
>  3. |    B    1      warm   6     |
>  4. |    B    2     rainy         |
>     +-----------------------------+
> How to realize it?

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index