Hi reader,
I would like to know how I could make these formulas a bit shorter, hope you can help.
Formula 1:
retX and retcX are in columns, firms in rows
gen ar2=ret2-retc2
gen ar3=ret3-retc3
gen ar4=ret4-retc4
gen ar5=ret5-retc5
gen ar6=ret6-retc6
gen ar7=ret7-retc7
gen ar8=ret8-retc8
gen ar9=ret9-retc9
gen ar10=ret10-retc10
gen ar11=ret11-retc11
gen ar12=ret12-retc12
gen ar13=ret13-retc13
gen ar14=ret14-retc14
gen ar15=ret15-retc15
gen ar16=ret16-retc16
gen ar17=ret17-retc17
gen ar18=ret18-retc18
gen ar19=ret19-retc19
gen ar20=ret20-retc20
gen ar21=ret21-retc21
gen ar22=ret22-retc22
gen ar23=ret23-retc23
gen ar24=ret24-retc24
gen ar25=ret25-retc25
gen ar26=ret26-retc26
gen ar27=ret27-retc27
gen ar28=ret28-retc28
gen ar29=ret29-retc29
gen ar30=ret30-retc30
gen ar31=ret31-retc31
gen ar32=ret32-retc32
gen ar33=ret33-retc33
gen ar34=ret34-retc34
gen ar35=ret35-retc35
gen ar36=ret36-retc36
gen ar37=ret37-retc37
gen ar38=ret38-retc38
Formula 2:
gen ret3year= ((1+ret2)*(1+ret3)*(1+ret4)*(1+ret5)*(1+ret6)*(1+r et7)*(1+ret8)*(1+ret9)*(1+ret10)*(1+ret11)*(1+ret1 2)*(1+ret13)*(1+ret14)*(1+ret15)*(1+ret16)*(1+ret1 7)*(1+ret18)*(1+ret19)*(1+ret20)*(1+ret21)*(1+ret2 2)*(1+ret23)*(1+ret24)*(1+ret25)*(1+ret26)*(1+ret2 7)*(1+ret28)*(1+ret29)*(1+ret30)*(1+ret31)*(1+ret3 2)*(1+ret33)*(1+ret34)*(1+ret35)*(1+ret36)*(1+ret3 7))-1
gen retc3year= ((1+retc2)*(1+retc3)*(1+retc4)*(1+retc5)*(1+retc6) *(1+retc7)*(1+retc8)*(1+retc9)*(1+retc10)*(1+retc1 1)*(1+retc12)*(1+retc13)*(1+retc14)*(1+retc15)*(1+ retc16)*(1+retc17)*(1+retc18)*(1+retc19)*(1+retc20 )*(1+retc21)*(1+retc22)*(1+retc23)*(1+retc24)*(1+r etc25)*(1+retc26)*(1+retc27)*(1+retc28)*(1+retc29) *(1+retc30)*(1+retc31)*(1+retc32)*(1+retc33)*(1+re tc34)*(1+retc35)*(1+retc36)*(1+retc37))-1
Formula 3:
I need to count days per firm, since there are over 1000 different firms, what would be a smart command to generate the counted days?
Appreciate the help
Related Posts with How to write shorter
datetime translationHello, I'm facing trouble telling stata the format of my time variable. My time variable "time" has…
Expanding rows by number sequenceI'm trying to rearrange the database below. I am looking for a command that extracts each number in …
Using time series data where observation dates do not alignI am in the currently writing my dissertation in which I need to forecast future GDP growth using as…
Generate variables to capture heat stressDear all I have daily minimum and maximum temperature data from 697 weather stations across 311 dist…
Dropping observations based on multiple conditionsHi. I am pasting a sample of the date of I am working with: Code: * Example generated by -dataex-.…
Subscribe to:
Post Comments (Atom)
0 Response to How to write shorter
Post a Comment