Announcement

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

  • Retrieving the right variable in dataset

    Dear users,

    My database consists of 26 countries with their daily stock returns from 1973, football matches of those countries on World Cups/European Cups for the last 40 years, the day of the week, and two dummies: "Win" and "Loss" for each football match. For all the wins and losses I have to get the first available trading day's stock return of that specific country and gather all those returns in a Win and a Loss group. Note that the majority of the matches is played on Saturday, so the stock return on Monday should be taken. I can't manage to tell Stata to take the country's first available stock return after a match. Many thanks for your help.

    Best,
    Lucas Lemmens

  • #2
    Generally if you sort by some variables, you can use the _n == 1 construct to pick off the first of the bygroup. You might show a little of your data sorted to encourage a response. Be sure to post the data inside code formats so the font is monospaced.

    Comment

    Working...
    X