Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Duha Altindag <daltin2@tigers.lsu.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Difference operator will not calculate the correct difference |

Date |
Sun, 8 Aug 2010 23:48:52 -0500 |

Greetings, I thought the difference operator, D, worked like the following: dn.x = x(t)-x(t-n) n is an integer. However, Stata is getting me something different, I couldn't figure out what. Please, run the following to replicate the problem: ********begin********* clear use http://www.stata-press.com/data/r11/nlswork.dta xtset idcode year g d2_age=age-l2.age list idcode year age l2.age d2_age d2.age ,noobs *********end*********** And compare d2_age and D2.age columns. ------------------------------------------+ | L2. D2.| | idcode year age age d2_age age | |------------------------------------------| | 1 70 18 . . . | | 1 71 19 . . . | | 1 72 20 18 2 0 | | 1 73 21 19 2 0 | | 1 75 23 21 2 . | |------------------------------------------| | 1 77 25 23 2 . | | 1 78 26 . . . | | 1 80 28 26 2 . | | 1 83 31 . . . | | 1 85 33 31 2 . | |------------------------------------------| | 1 87 35 33 2 . | | 1 88 37 . . . | | 2 71 19 . . . | | 2 72 20 . . . | | 2 73 21 19 2 0 | |------------------------------------------| Am I missing something? * * 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: Difference operator will not calculate the correct difference***From:*Dani Tilley <tilleydani@yahoo.com>

- Prev by Date:
**st: lpoly and nonmissing fitted values where the dependent variable is missing** - Next by Date:
**st: re: Contingency tables etc. in Stata and SPSS** - Previous by thread:
**st: lpoly and nonmissing fitted values where the dependent variable is missing** - Next by thread:
**Re: st: Difference operator will not calculate the correct difference** - Index(es):