Dear Statalist members,

Having extensively browsed the Statalist forums without finding an answer to my problem, here my first Statalist post.

I feel like my problem is a rather simple one, but I can't seem to find a solution. I have simplified the dataset which I am sharing so it is more accessible to answer. The dataset is a panel data with 10 groups (portfolios), each with a time series of returns. I am trying to create an extra group with time series (let's say group 11), which is the time series corresponding to group 10 subtracted from the time series corresponding to group 1. So basically creating a new group in the portfolio variable with a time series that is group 1 minus group 10.

I did my best explaining the problem as clear as possible and providing the data in the proper way. If there's anything else I can do, let me know.

Code:
* Example generated by -dataex-
clear
input float portfolio double date float portfolio_return
 1 122   .012888074
 1 123     .0882777
 1 124    .04657736
 2 122   .009225255
 2 123    .09750874
 2 124   .033946674
 3 122 -.0009811557
 3 123     .1574389
 3 124    .05911349
 4 122  -.007032099
 4 123    .10665072
 4 124    .05418406
 5 122   .008013441
 5 123   .002559167
 5 124   .064446874
 6 122    .00419381
 6 123    .13284719
 6 124   .019531103
 7 122 -.0014485664
 7 123    .04413781
 7 124    .05019293
 8 122   .015479586
 8 123     .0452802
 8 124    .05254846
 9 122 -.0010566637
 9 123    .04960196
 9 124    .04430628
10 122    .02943923
10 123    .09573173
10 124    .03807938
end
format %tm date
Many thanks in advance,

Dinand