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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: Reshape related |

Date |
Sat, 22 Nov 2008 23:19:21 +0100 |

HTH Martin _______________________

To: <statalist@hsphsun2.harvard.edu> Sent: Saturday, November 22, 2008 11:12 PM Subject: st: Reshape related

Hi All, Perhaps the subject line is not the best one to address my problem, but here it is: My original data set is of the 'long' format like this gvkey year revenue 1000 1999 111 1000 2000 222 . . 1001 1999 888From this I want to retrieve only one value of revenue per 'gvkey'which corresponds to a year value that i lookup in a different database. So if in the other data base my gvkey is 1000 and lookupyear is 2000, then only 222 should be in the revenue cell of the final database. I can think of numerous inelegant ways to do this using Excel. But the most elegant solution would be (i think) something like this. step 1: reshape to wide: so the data now looks like this gvkey revenue1999 revenue2000..... 1000 111 222 1001 888 step 2: gen singlerev = the value contained in the cell whose name is ("revenue" +"lookupyear") The problem I have is finding the function that does this:" the value contained in the cell whose name is ("revenue" +"lookupyear") )Any help is appreciated. Any simpler way to do this is even moreappreciated.Thanks Kiron * * 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/

**Follow-Ups**:**Re: st: Re: Reshape related***From:*Kir1 <kiron.r@gmail.com>

**References**:**st: Reshape related***From:*Kir1 <kiron.r@gmail.com>

- Prev by Date:
**[no subject]** - Next by Date:
**st: Re: xtmixed models of observations that are first nested and then crossed** - Previous by thread:
**st: Reshape related** - Next by thread:
**Re: st: Re: Reshape related** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |