Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Take the value from variable X if year equals 2010


From   Torsten Häberle <[email protected]>
To   [email protected]
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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index