Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Reshape and Changing Data


From   Gauri Khanna <gwkhanna@hotmail.com>
To   Stata List <statalist@hsphsun2.harvard.edu>
Subject   st: Reshape and Changing Data
Date   Sun, 21 Jun 2009 13:41:08 +0000

Dear Stata List, 
I would like to –reshape- my data. 
Currently, my data is arranged such that the age-specific populations appear as one observation for each year and sex: 
Year  UN_Name Un_Code Sex Age15 Age20 Age25……Age80  Reg6  Reg14
2005  Albania      8               1      500    466      453             150 Eur    EurD
2006  Albania      8               1      550    500      498             160 Eur     EurD
2010  Albania      8               1      600    567      542             165 Eur    EurD
2005  Albania      8               2      400    395      350             140 Eur    EurD
2006  Albania      8               2      498    445      390             121 Eur    EurD
2010  Albania      8               2      534    500      486              133 Eur    EurD
2005  Andorra     20             1       500    450      423             100      Eur     EurC
2006  Andorra     20             1       534    480      420             110      Eur     EurC
……
I would like to reshape it so that for every year and sex, each age in the age-specific population is one observation and appears alongside the population number it represents to be as:  
Year  UN_Name Un_Code Sex  Age        Pop  Reg6  Reg14
2005  Albania       8               1     Age15   500      Eur     EurD
2005  Albania       8               1     Age20   466      Eur     EurD
2005 Albania        8               1     Age25   453      Eur     EurD
2005 Albania        8               1     Age30   …….
..
..
2005  Albania       8               2     Age15   400      Eur     EurD
2005  Albania       8               2     Age20   395      Eur     EurD
2005  Albania       8               2     Age25   350      Eur     EurD
2005  Albania       8               2     Age30   ……    Eur     EurD
..
I tried to reshape my data when I ran into several errors + there is the added complication of creating a two new variables of « Age » and « Pop ». 
 
Will be grateful for your help. 
 
Regards, 
Gauri 
_________________________________________________________________
Windows Live™: Keep your life in sync. Check it out!
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index