Hello,

I have the following code:
Code:
generate dayofmonth = day(date)
rename (THENATIVE-ZWAHLENMAYR) (return=)
reshape long return, i(date) j(Firm) string
sort Firm date
order Firm date
generate adjret = 1 * return
replace adjret = -1 * return if dayofmonth>=16
As you can see i go for the days 1 - 15 of the month long position (100%) and for the 2nd half of the month short position (-100%). Now i would like to go long for the last day of the month also (so the last day of the month should als .
The Problem here is cannot write for example
Code:
replace adjret = 1 * return if dayofmonth=30
because the last trading month could be the 29th, 30th or 31st. The last trading day for February could also be the 26th. I tried it with if-functions, but couldn't get it done.
Can someone help me with this?