Announcement

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

  • Calculation across cells using an identifier variable

    Hello Community,

    I hope someone can help me out with my Stata problem.

    Basically, I would like to subtract two points in time form one another (insterTime - startTime), using an identifier variable (ID) as well as several conditions (received Message = 1 and Typ).

    Here is an excerpt from my data:

    received message.PNG

    I thought something along the following lines could work, but I simply do not know enough about coding in Stata:

    {(itemInster if Typ == Hotel) – (ItemStart – 5 days if Typ == Flug)} if recivedHotelMissing ==1 & id match

    Ideally, Stata would give me something like this:

    received message with gap.PNG

    Thank you in advance

  • #2
    Other people's machines and software may -- indeed will -- differ, but I can't read either of those. At all.

    Please hop over to https://www.statalist.org/forums/help#stata and especially read 12.5 on why images of screenshots unfortunately don't help (usually) and 12.2 on using dataex to show data examples readably.

    The line of code you give doesn't make sense either. There is no command in there.

    Everyone starts using Stata for the first time, some time. Some things will seem weird. The learning curve is steep. If you put in a little effort (horizontal axis), you will learn a lot (vertical axis).

    Comment

    Working...
    X