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

From |
Jeetendra Aryal <jeetendra.aryal@umb.no> |

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

Subject |
st: RE: Generating a new variable....tricky question? |

Date |
Fri, 6 Mar 2009 12:11:33 +0100 |

If I have understood what you really want, try this!! .sort country .by country: gen gdp_y1=GDP[1] .gen FDIgdp_y1= FDI*gdp_y1 hope it helps. Jeetendra Prakash Aryal Research Fellow Department of Economics and Resource Management, Norwegian University of Life Sciences (UMB) P.B. 5003, N-1432, Aas Norway >-----Original Message----- >From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- >statalist@hsphsun2.harvard.edu] On Behalf Of A. Acharya >Sent: Thursday, March 05, 2009 2:08 PM >To: statalist@hsphsun2.harvard.edu >Subject: st: Generating a new variable....tricky question? > >hello, > > >I have a panel dataset with variables for 88 countries each for 5 time >periods. > >E.g. >country year GDP FDI >Algeria 1 x . >Algeria 2 . . >Algeria 3 . . >Algeria 4 . . >Algeria 5 . . >Argentina 1 y . >Argentina 2 . . >Argentina 3 . . >Argentina 4 . . >Argentina 5 . . >etc >etc > > >Where the dots indicate particular numeric observations. I want to >generate >a new variable which for EACH country multiplies FDI by the INITIAL GDP >value in year 1. E.g. for the case of Algeria, FDI in year 1 would be >multiplied by GDP in year 1 (denoted by x), then FDI in year 2 would be >multiplied by GDP in year 1 (denoted by x), then FDI in year 3 would be >multiplied by GDP in year 1 (denoted by x) and so on. Then obviously, >once >we get to argentina, it should start multiplying by GDP in argentina's >year >1 (denoted by y) and then year 2 FDI in argentina by y and so on. > >My question is: How can I generate this variable? > >I would really appreciate your help. > >Anish >(University of Cambridge) > >* >* 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/

**References**:**st: Generating a new variable....tricky question?***From:*"A. Acharya" <aa464@cam.ac.uk>

- Prev by Date:
**Re: st: 64-bit Stata for Mac now available** - Next by Date:
**st: Correlation example** - Previous by thread:
**st: AW: Generating a new variable....tricky question?** - Next by thread:
**Re: st: Generating a new variable....tricky question?** - Index(es):

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