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: lag
From
"Fabian Schönenberger" <[email protected]>
To
[email protected]
Subject
st: lag
Date
Thu, 31 May 2012 10:52:01 +0200
Dear Statalist
With the following command I want to generate a dummy variable; 1 if current sales are lower than 4 years ago, 0 if sales are larger for each company:
by cusip: generate sale_decrease5=0 if sale>sale[_n-4]
by cusip: replace sale_decrease5=1 if sale<=sale[_n-4]
I expected for each cusip 4 missings at the beginning, since there is no _n-4. However, the command gives 1 for each cusip in the first four years.
How do I have to adapt the formula to get dummy variables after the first 4 years passed?
Many thanks in advance.
Fabian
--
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
*
* 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/