I am new to both this forum as to Stata.
I have a question regarding how to graph dummy variables.
I have a dataset consisting of different firms and different firm years. I have two dummy variables namely 1 for divestititures (dumdiv) and 1 for acquisitions (dumacq)
I want to graph the frequency of the amount of dummy=1 , per year.
this is how the tabulate version looks (of 1 variable)
What kind of graph do you want (bar, scatterplot, line graph...)?
A bar graph is easiest because the frequency of the dummy==1 is equal to the sum of the dummy variables:
graph bar (sum) dumdiv, over(Year)
If you want to use a -twoway- plot type (such as a line graph) you're best to collapse the dataset into the table that you posted:
collapse (sum) dumdiv, by(Year)
line dumdiv Year
If you want to create the graph without destroying your original data you can use -preserve-, like this:
preserve
collapse (sum) dumdiv, by(Year)
line dumdiv Year
restore