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]

st: Creating long, filledin dataset from two, year variables


From   "Kevin O'Connell" <[email protected]>
To   statalist <[email protected]>
Subject   st: Creating long, filledin dataset from two, year variables
Date   Sat, 5 Mar 2011 20:33:50 -0800

Hi,
I am trying to move a dataset that was built with a start year, start
year population and end year to having a long format.  I guessed this
was a double-wide dataset, but I couldnt get my variables to match up,
or to fillin .

  id     pop          startyear endyear
1       11000   1818            1822
2       1500            1820            1824
3       15000   1820             1823
4       2200            1821            1836
5       2000             1821   1840
6       125000  1821             1828

I am trying to get the dataset into this format so I can fill in
missing variables for population over the time span between start and
end:

id  year pop
1 1818  11000
1 1819
1 1820
1 1821
1 1822
2  1820  1500
2  1821
2  1822
2  1823
2  1824

and so on.
There are about 5000 years within 500 id, so I am hoping to find a
better solution that data entry, but i dont know the right
term/command for what I am trying to do.

Thanks,
Kevin

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