Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Torsten Häberle <haeberle.torsten@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Take the value from variable X if year equals 2010 |
Date | Mon, 20 Jan 2014 09:57:09 +0100 |
Hey, I have the following table Year Adjustment factor Dollar 2005 3 500 2004 2 200 2009 4 300 2010 7 400 2009 4 200 2010 7 100 .... ... Now I want to generate a new variable. The new variable is Dollar * Adjustment factor of year 2010 --> Basically, I want to multiply all my dollar values with the adjustment factor of 2010. This seems easy, but I don't get it. Something like: gen newdollar = dollar*(adjustment factor if year=="2010") Thanks * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/