Hello,

I want to make two graphs in Stata but I don't know how to do that.
I have the following dataset.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double pat_yr float(maactive totalma)
             195.5 0  0
             172.5 0  0
             152.5 1  1
             130.5 1  1
               136 1  2
             134.5 1  3
             128.5 1  4
              99.5 1  5
              64.5 1  5
               178 1  6
             153.5 1  7
             170.5 1  7
             212.5 1  8
               480 1  9
               630 1 10
             692.5 1 11
               674 1 12
             573.5 1 13
             465.5 1 14
                 6 1  1
                 0 1  1
             273.5 0  0
               556 0  0
               830 0  0
              1053 0  0
            1091.5 0  0
1153.8333740234375 1  1
               908 1  2
             812.5 1  2
             539.5 1  2
               510 1  3
             339.5 1  3
               235 1  3
             246.5 1  3
 230.8333282470703 1  3
               253 1  3
               262 1  4
               287 1  4
 297.8333282470703 1  4
               246 1  4
              72.5 1  1
                82 1  2
                87 1  2
               105 1  2
                87 1  3
                77 1  4
             105.5 1  5
                77 1  6
              61.5 1  6
              71.5 1  7
              73.5 1  8
                74 1  9
                62 1  9
                62 1 10
              58.5 1 11
                87 1 12
                92 1 13
                81 1 14
                63 1 14
                 1 0  0
               4.5 0  0
               5.5 0  0
                 5 0  0
                 2 0  0
                 1 0  0
                 0 0  0
                 2 0  0
                 1 0  0
                 1 0  0
                 0 0  0
                 1 0  0
                 0 0  0
                 1 0  0
                 2 0  0
                 7 0  0
                 0 0  0
                 0 0  0
                 0 0  0
               191 0  0
               241 0  0
               408 0  0
               496 1  1
               535 1  2
               558 1  3
               531 1  4
               641 1  5
               535 1  6
               650 1  7
               640 1  8
               799 1  9
             873.5 1 10
              1111 1 11
              1059 1 11
              1126 1 12
            1039.5 1 13
            1095.5 1 14
              1176 1 15
                 2 0  0
                 0 0  0
                 1 0  0
end
I want to make 1 graph with on the y-axis average patenting output (pat_yr variable) and on the x-axis variable maactive (dummy variable with 0 and 1 in it). So on the left side of the graph I want average patenting output when maactive = 0 and on the right side when maactive = 1.

The second graph I want to make is with on the y-axis average patenting output (pat_yr variable) and on the x-axis totalma (variable that counts the total number of M&A a firm has made, maximum value is 17). So I want to have graph that shows the average number of patents per number of M&A.

Is there anyone who could help me with this?

Thanks in advance