Announcement

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

  • Generate new variable as difference of the values from the basis of previous

    Dear Stata Users,

    I want to create a new variable as "Profit" based on the previous variable that includes both "Revenue" and "Cost".

    It is too laborious to do it manually because the number of observations is more than 2 lakh.

    For example:

    ID Code: (Revenue=1, Cost=2) Total Profit
    12 1 1000 500
    12 2 1500 .
    13 1 500 500
    13 2 1000 .
    14 2 500 .
    14 1 100 400
    15 1 300 200
    15 2 500 .



    Thank you very much.
    Last edited by shakir malik; 10 Jan 2025, 05:04.

  • #2
    Duplicate post. Please follow https://www.statalist.org/forums/for...vious-variable if interested.

    Comment

    Working...
    X