Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • constructing cumulating variable

    Hello All, My Name is John Tedd.

    I want to construct a variable like Xijt=Xij1960+Xijt[-n-1]. Xijt is labor productivity and the time period is from 1960-2010, for country i, sector j and year t. The point is that I have to have labor productivity in 1960 first. Then I want to use that a base and calculate for the rest. For example Xij1961=Xij1960+ Zijt (another variables). Xij1962=Xij1961+Zijt, Xij1963=Xij1962+Zijt etc

    Can you help me how to write a code that can work like this?

    Thanks
    Last edited by John Ted; 04 Nov 2016, 04:57.

  • #2
    John:
    welcome to the list.
    Is what you're after is a running sum, see -help sum()-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X