Statalist


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

AW: st: AW: reshaping mixed monthly & annual data


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: reshaping mixed monthly & annual data
Date   Wed, 14 Oct 2009 15:57:00 +0200

<> 

I am not quite sure I understand your problem, but maybe this helps:



*************
clear*

inp id y1990 b11990 b21990 /* 
*/ b31990 b41990 b51990 b61990
1 100 200 300 1 0 0 0 0 0
2 200 300 400 0 0 1 0 0 0
3 300 400 500 0 0 0 0 0 1
4 400 500 600 0 0 0 1 0 0
5 500 600 700 0 1 0 0 0 0
end

reshape long b, i(id) j(date)
gen month=substr(string(date), 1,1)
gen year=substr(string(date), 2,.)
destring  month year, replace
drop date

rename y1990 income
order  id month year income b
list, noobs sepby(id)
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Jon Schwabish
Gesendet: Mittwoch, 14. Oktober 2009 14:35
An: [email protected]
Betreff: re: st: AW: reshaping mixed monthly & annual data

Martin asked for an example of the data. A simple example is copied below
with one year of annual earnings in 1990 and benefit indicators for the
first six months of 1990. 

input id y1990 b11990 b21990 b31990 b41990 b51990 b61990
1 100 200 300 1 0 0 0 0 0
2 200 300 400 0 0 1 0 0 0
3 300 400 500 0 0 0 0 0 1
4 400 500 600 0 0 0 1 0 0
5 500 600 700 0 1 0 0 0 0
end


Thanks,
jon


      

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


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index