Hello,
I'm working with daily financial data and I have 2 binary variables (called events and news) that take value 1 when there is an event or news in a given day that may influence my country financially. I would like to make a graph sort of as initial summary statistics, to show the percentage of days where there were news and events in each month, but I'm not sure how to code this.
I have tried:
But I'm not really sure if this is it, because it appears to me that this just calculates the average of both dummies for the month, and not the percentage of days in a month.
Here's a sample of the data:
Thank you in advance.
I'm working with daily financial data and I have 2 binary variables (called events and news) that take value 1 when there is an event or news in a given day that may influence my country financially. I would like to make a graph sort of as initial summary statistics, to show the percentage of days where there were news and events in each month, but I'm not sure how to code this.
I have tried:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear gen month=month(date) gen yr=year(date) graph bar (mean) events news , over(month) over(yr) ytitle(proportion events news) end
Here's a sample of the data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int date float(month yr events news) 17244 3 2007 0 0 17245 3 2007 0 0 17246 3 2007 0 0 17247 3 2007 0 0 17248 3 2007 0 0 17251 3 2007 0 0 17252 3 2007 0 0 17253 3 2007 0 0 17254 3 2007 0 0 17255 3 2007 0 0 17258 4 2007 0 0 17259 4 2007 0 0 17260 4 2007 0 0 17261 4 2007 0 0 17262 4 2007 1 1 17265 4 2007 1 1 17266 4 2007 0 0 17267 4 2007 0 0 17268 4 2007 0 0 17269 4 2007 1 0 17272 4 2007 1 0 17273 4 2007 1 0 17274 4 2007 0 0 17275 4 2007 0 0 17276 4 2007 0 0 17279 4 2007 0 0 17280 4 2007 0 0 17281 4 2007 0 0 17282 4 2007 0 0 17283 4 2007 0 0 17286 4 2007 0 0 17287 5 2007 1 1 17288 5 2007 0 0 17289 5 2007 0 0 17290 5 2007 0 0 17293 5 2007 0 0 17294 5 2007 0 0 17295 5 2007 1 1 17296 5 2007 1 1 17297 5 2007 1 1 17300 5 2007 1 1 17301 5 2007 0 0 17302 5 2007 0 0 17303 5 2007 0 0 end format %tdnn/dd/CCYY date
Comment