Hi,
I have a file with a date column and 5 other daily return columns. File attached.
I use the below code to get monthly return :
import delimited "C:\Users\Aakash\Desktop\AIA\Clean Data\AQR_BAB_Factors.csv", case(preserve)
gen trdate = date(Date,"MDY")
format %td trdate
tsset trdate
ascol AQR_BAB_Equity_Global, returns(simple) keep(all) tomonth gen(AQR_BAB_MonthlyGlobal)
drop month_id
ascol AQR_BAB_Equity_Global_Ex_USA, returns(simple) keep(all) tomonth gen(AQR_BAB_MonthlyGlobalExUSA)
drop month_id
ascol AQR_BAB_Equity_Europe, returns(simple) keep(all) tomonth gen(AQR_BAB_MonthlyEurope)
drop month_id
ascol AQR_BAB_Equity_NorthAmerica, returns(simple) keep(all) tomonth gen(AQR_BAB_MonthlyNorthAmerica)
drop month_id
ascol AQR_BAB_Equity_Pacific, returns(simple) keep(all) tomonth gen(AQR_BAB_MonthlyPacific)
Now I need only the monthend dates. I need all last day of month even if its not standard month-end date.
How do I do that ?
I tried the below :
gen long first_of_next_month = dofm(mofd(trdate)+1)
keep if trdate + 1 == first_of_next_month
But this returns only standard month-end dates and deletes all other data.
Could someone help?
Related Posts with Drop all values other than month-end dates where the dates dont always end on standard monthend say there would be a value 27th May.
GSEM identify latent classesI am trying to learn latent class models. I don't know much about them. I'm trying to figure out how…
Creating one year lagged variable for law ( state by year panel data)Hello stata community, I have a panel set of law effective data for state by year , and I need to c…
Marginsplot: logit regression, IV is continous and moderator is a dummyDear Statalist, I run a logit regression and my IV is a continuous variable (average: -1.5, min: -2…
ResultsHi, I am dealing w/ panel data and am running 3 regressions based on a dummy variable that indicate…
Exporting LaTeX regression table with 2 group classifications, using esttabI am using the command esttab in Stata to export a regression table. I would like to label my models…
Subscribe to:
Post Comments (Atom)
0 Response to Drop all values other than month-end dates where the dates dont always end on standard monthend say there would be a value 27th May.
Post a Comment