Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Newbie question on creating variable


From   Philip Ryan <[email protected]>
To   [email protected]
Subject   Re: st: Newbie question on creating variable
Date   Tue, 02 Mar 2004 09:31:05 +1030

Another approach involves use of -reshape- :

   reshape wide gdp, i(countrycode) j(year)
   gen diff = gdp1970 - gdp1965

and then, optionally:

   reshape long


Phil







At 02:14 PM 1/03/2004 -0500, you wrote:
countrycode year gdp
BAN 1960 65
BAN 1965 75
BAN 1970 85
CAN 1960 25
CAN 1965 35
CAN 1970 45

Dear Stata users,
Lets say I have the above data set. I want to create a variable which measures the difference between the gdp in year 1970 and gdp in 1965 for each country. That is if "diff" is the new variable it would be diff = gdp(1970)-gdp (1965) for each country.
I am a new user and already spent hours on this. I would much appreciate your help.
Thanks in advance
AmBush
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
Philip Ryan
Associate Professor,
Department of Public Health
Associate Dean (Information Technology)
Faculty of Health Sciences
University of Adelaide 5005
South Australia
tel 61 8 8303 3570
fax 61 8 8223 4075
http://www.public-health.adelaide.edu.au/
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright. If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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