Hi naveen, thanks for the code, its actually quite simple and I probably should have been able to figure it out, but when posing the question I had in mind calculating the max as part of a bigger code. And what a lucky coincidence!!! Yesterday you answered my question about lagged returns with the following code: data ind_lag; set ind_sect; by sector; k=lag(price); if not first.sector then return = (price - k) / k; drop k; run; On the same discussion, I was already given an answer for calculating the return between any 2 periods, and wanted to add to it the max price (and its date) between these 2 periods, and that's why I asked the present question. I guess that now I can just merge max price and date table of your code with the return for each stock bw 2 periods. Thanks again!!
... View more