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]

From |
Fabian Schönenberger <fabian.schoenenberger@gmail.com> |

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

Subject |
st: AW: AW: Regressions with constant independent variable |

Date |
Wed, 11 Apr 2012 11:45:50 +0200 |

Many thanks! I have used: By cusip (fyear), sort: generate firstlnsales=lnsales[1] if (lnebit [1] !=0). This one works fine. However, I would like to adjust the formula, in order to get observation 2 if lnebit [1] is 0, and then observation 3 if observation 2 is 0 and so on. Any suggestions? Best, Fabian -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Dithmer, Jan Gesendet: Mittwoch, 11. April 2012 10:49 An: statalist@hsphsun2.harvard.edu Betreff: st: AW: Regressions with constant independent variable If you want to create a new variable, s.th like the following may work (if I understand you correctly): by cusip: gen salesinitial = sales if fyear=="first observation of fyear" by cusip: replace salesinitial = salesinitial[_n-1] if salesinitial==. It may be possible to do it in one step, but unfortunately I don't know how and would also be interested in a shorter solution. Best, Jan -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Fabian Schönenberger Gesendet: Wednesday, April 11, 2012 8:55 AM An: statalist@hsphsun2.harvard.edu Betreff: st: Regressions with constant independent variable Dear Statalist I would like to run a regression like Y=a + b*x + c*z + e for panel data. ID is cusip, and t is fyear, x is sales and z is growth of sales. I would like to keep x fixed for each cusip at the level of the first observation of fyear. Do I need to create a new variable or can I adjust my regression formula? Many thanks in advance. FS * * 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/ * * 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/

**Follow-Ups**:**Re: st: AW: AW: Regressions with constant independent variable***From:*Eric Booth <eric.a.booth@gmail.com>

**References**:**st: Regressions with constant independent variable***From:*Fabian Schönenberger <fabian.schoenenberger@gmail.com>

**st: AW: Regressions with constant independent variable***From:*"Dithmer, Jan" <jdithme@food-econ.uni-kiel.de>

- Prev by Date:
**st: AW: Regressions with constant independent variable** - Next by Date:
**Re: st: meanonly** - Previous by thread:
**st: AW: Regressions with constant independent variable** - Next by thread:
**Re: st: AW: AW: Regressions with constant independent variable** - Index(es):