Dear Statalists,
I am trying to calculate monthly returns for specific firms and would like to know how it can be done. Online i found command bysort DSCD : gen return = 100*ln(Price[_n]/Price[_n-1]) however it messes up the month and year ordering. I guess its the wrong command to use it. I have 41 countries with all the companies that were listed between 1980-2003 and below you can see the portion of it:

----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 DSCD double Price str14 Country float(month year)
"131879" 7.88 "Argentina" 11 1993
"131879" 14.05 "Argentina" 1 1994
"131879" 12.1 "Argentina" 2 1994
"131879" 9.43 "Argentina" 4 1994
"131879" 9.95 "Argentina" 5 1994
"131879" 8.36 "Argentina" 6 1994
"131879" 8.64 "Argentina" 7 1994
"131879" 9.37 "Argentina" 8 1994
"131879" 8.85 "Argentina" 9 1994
"131879" 8.12 "Argentina" 10 1994
"131879" 8.23 "Argentina" 11 1994
"131879" 4.07 "Argentina" 1 1995
"131879" 3.3 "Argentina" 2 1995
"131879" 4.83 "Argentina" 3 1995
"131879" 4.45 "Argentina" 4 1995
"131879" 5.28 "Argentina" 5 1995
"131879" 4.68 "Argentina" 6 1995
"131879" 4.9 "Argentina" 7 1995
"131879" 4.75 "Argentina" 8 1995
"131879" 4.37 "Argentina" 9 1995
"131879" 3.77 "Argentina" 10 1995
"131879" 5.02 "Argentina" 11 1995
"131879" 8.29 "Argentina" 1 1996
"131879" 7.59 "Argentina" 2 1996
"131879" 6.98 "Argentina" 3 1996
"131879" 7.91 "Argentina" 4 1996
"131879" 9.7 "Argentina" 5 1996
"131879" 9.62 "Argentina" 6 1996
"131879" 7.65 "Argentina" 7 1996
"131879" 7.11 "Argentina" 8 1996
"131879" 7.41 "Argentina" 9 1996
"131879" 8.21 "Argentina" 10 1996
"131879" 9.04 "Argentina" 11 1996
"131879" 10.19 "Argentina" 1 1997
"131879" 10.76 "Argentina" 2 1997
"131879" 11.58 "Argentina" 3 1997
"131879" 11.38 "Argentina" 4 1997
"131879" 12.9 "Argentina" 5 1997
"131879" 12.73 "Argentina" 6 1997
"131879" 13.39 "Argentina" 7 1997
"131879" 12.07 "Argentina" 8 1997
"131879" 11.33 "Argentina" 9 1997