Hi all,
here is my data:
---------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
After every cameocode: The number of events that take place recorded in a observations is mentioned.
What I would like is: all events on a monthly basis for example for the 4 existing quadclasses.
every observations holds 1 or more events.
I tried:
this I think gives me the monthly count but by observation.
How can I add in the amount of events per observations?
thank you guys,
here is my data:
---------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str8 date str18 source str19 target str4 cameocode int numevents long numarts byte quadclass float goldstein str6 YearMonth str4 year "19930101" "USA" "AFR" "042" 1 4 1 1.9 "199301" "1993" "19930101" "USA" "ALB" "130" 1 2 3 -4.4 "199301" "1993" "19930101" "USA" "BUS" "020" 1 8 1 3 "199301" "1993" "19930101" "USA" "BUS" "154" 1 8 4 -7.2 "199301" "1993" "19930101" "USA" "CHE" "030" 2 9 1 4 "199301" "1993" "19930101" "USA" "CHE" "036" 1 4 1 4 "199301" "1993" "19930101" "USA" "CHE" "042" 1 2 1 1.9 "199301" "1993" "19930101" "USA" "CHE" "046" 1 4 1 7 "199301" "1993" "19930101" "USA" "CHN" "012" 1 4 1 -.4 "199301" "1993" "19930101" "USA" "CHN" "043" 1 8 1 2.8 "199301" "1993" "19930101" "USA" "CHN" "112" 1 6 3 -2 "199301" "1993" "19930101" "USA" "CUB" "013" 1 8 1 .4 "199301" "1993" "19930101" "USA" "CUB" "043" 1 8 1 2.8 "199301" "1993" "19930101" "USA" "CUBREF" "075" 1 16 2 7 "199301" "1993" "19930101" "USA" "EDU" "042" 2 4 1 1.9 "199301" "1993" "19930101" "USA" "EDU" "043" 4 9 1 2.8 "199301" "1993" "19930101" "USA" "EDU" "051" 1 1 1 3.4 "199301" "1993" "19930101" "USA" "FRA" "036" 1 4 1 4 "199301" "1993" "19930101" "USA" "FRA" "043" 3 10 1 2.8 "199301" "1993" "19930101" "USA" "GOV" "010" 3 8 1 0 "199301" "1993" "19930101" "USA" "GOV" "020" 2 4 1 3 "199301" "1993" "19930101" "USA" "GOV" "040" 5 11 1 1 "199301" "1993" "19930101" "USA" "GOV" "042" 2 9 1 1.9 "199301" "1993" "19930101" "USA" "GOV" "052" 1 9 1 3.5 "199301" "1993" "19930101" "USA" "GOV" "057" 2 8 1 8 "199301" "1993" "19930101" "USA" "GRD" "010" 1 2 1 0 "199301" "1993" "19930101" "USA" "HLH" "042" 2 8 1 1.9 "199301" "1993" "19930101" "USA" "IGOUNO" "036" 1 12 1 4 "199301" "1993" "19930101" "USA" "IGOUNO" "040" 2 2 1 1 "199301" "1993" "19930101" "USA" "IRQ" "042" 2 10 1 1.9 "199301" "1993" "19930101" "USA" "IRQ" "080" 2 10 2 5 "199301" "1993" "19930101" "USA" "IRQ" "190" 2 9 4 -10 "199301" "1993" "19930101" "USA" "IRQ" "192" 2 2 4 -9.5 "199301" "1993" "19930101" "USA" "ITAGOV" "043" 1 2 1 2.8 "199301" "1993" "19930101" "USA" "JUD" "043" 1 8 1 2.8 "199301" "1993" "19930101" "USA" "JUD" "071" 1 1 2 7.4 "199301" "1993" "19930101" "USA" "LAB" "114" 1 3 3 -2 "199301" "1993" "19930101" "USA" "LBY" "043" 1 18 1 2.8 "199301" "1993" "19930101" "USA" "LKA" "070" 1 4 2 7 "199301" "1993" "19930101" "USA" "LKAGOV" "070" 2 15 2 7 "199301" "1993" "19930101" "USA" "MDV" "043" 1 2 1 2.8 "199301" "1993" "19930101" "USA" "MED" "014" 2 5 1 0 "199301" "1993" "19930101" "USA" "MED" "042" 1 2 1 1.9 "199301" "1993" "19930101" "USA" "MED" "100" 2 5 3 -5 "199301" "1993" "19930101" "USA" "MEX" "043" 1 6 1 2.8 "199301" "1993" "19930101" "USA" "MEX" "084" 2 4 2 7 "199301" "1993" "19930101" "USA" "MIL" "010" 1 1 1 0 "199301" "1993" "19930101" "USA" "MIL" "027" 1 2 1 4 "199301" "1993" "19930101" "USA" "MIL" "042" 1 1 1 1.9 "199301" "1993" "19930101" "USA" "MIL" "045" 1 2 1 5 "199301" "1993" "19930101" "USA" "MIL" "050" 1 3 1 3.5 "199301" "1993" "19930101" "USA" "PRK" "046" 1 4 1 7 "199301" "1993" "19930101" "USA" "PRKGOV" "046" 1 6 1 7 "199301" "1993" "19930101" "USA" "PSE" "051" 1 5 1 3.4 "199301" "1993" "19930101" "USA" "PSEREBOPP" "013" 1 4 1 .4 "199301" "1993" "19930101" "USA" "REB" "051" 2 4 1 3.4 "199301" "1993" "19930101" "USA" "RUS" "030" 3 9 1 4 "199301" "1993" "19930101" "USA" "RUS" "036" 4 9 1 4 "199301" "1993" "19930101" "USA" "RUS" "046" 1 8 1 7 "199301" "1993" "19930101" "USA" "RUS" "051" 4 22 1 3.4 "199301" "1993" "19930101" "USA" "RUS" "090" 1 3 2 -2 "199301" "1993" "19930101" "USA" "RUS" "130" 1 5 3 -4.4 "199301" "1993" "19930101" "USA" "SAU" "042" 3 18 1 1.9 "199301" "1993" "19930101" "USA" "SCGSRB" "046" 2 4 1 7 "199301" "1993" "19930101" "USA" "SOM" "020" 1 6 1 3 "199301" "1993" "19930101" "USA" "SOM" "036" 1 4 1 4 "199301" "1993" "19930101" "USA" "SOM" "042" 1 2 1 1.9 "199301" "1993" "19930101" "USA" "SOM" "0874" 1 10 2 10 "199301" "1993" "19930101" "USA" "SOM" "180" 3 9 4 -9 "199301" "1993" "19930101" "USA" "UKR" "030" 1 2 1 4 "199301" "1993" "19930101" "USA" "USAELI" "020" 2 5 1 3 "199301" "1993" "19930101" "USA" "USAGOV" "020" 1 2 1 3 "199301" "1993" "19930101" "USA" "USAGOV" "040" 1 1 1 1 "199301" "1993" "19930101" "USA" "USAJUD" "020" 1 1 1 3 "199301" "1993" "19930101" "USA" "USAMED" "043" 3 8 1 2.8 "199301" "1993" "19930101" "USA" "USAMIL" "130" 1 5 3 -4.4 "199301" "1993" "19930101" "USA" "USASPY" "010" 1 7 1 0 "199301" "1993" "19930101" "USA" "YEM" "194" 2 10 4 -10 "199301" "1993" "19930102" "USA" "CRM" "0874" 1 2 2 10 "199301" "1993" "19930102" "USA" "CVL" "100" 1 1 3 -5 "199301" "1993" "19930102" "USA" "EDU" "0311" 2 3 1 5.2 "199301" "1993" "19930102" "USA" "EDU" "043" 2 5 1 2.8 "199301" "1993" "19930102" "USA" "EDU" "053" 1 3 1 3.8 "199301" "1993" "19930102" "USA" "EDU" "071" 1 3 2 7.4 "199301" "1993" "19930102" "USA" "EDU" "100" 1 2 3 -5 "199301" "1993" "19930102" "USA" "ETHMED" "036" 1 2 1 4 "199301" "1993" "19930102" "USA" "FRA" "043" 2 4 1 2.8 "199301" "1993" "19930102" "USA" "FRA" "046" 1 2 1 7 "199301" "1993" "19930102" "USA" "FRA" "090" 1 2 2 -2 "199301" "1993" "19930102" "USA" "GOV" "040" 2 2 1 1 "199301" "1993" "19930102" "USA" "GOV" "043" 1 3 1 2.8 "199301" "1993" "19930102" "USA" "GOV" "046" 1 10 1 7 "199301" "1993" "19930102" "USA" "GOV" "060" 1 9 2 6 "199301" "1993" "19930102" "USA" "GRC" "042" 2 4 1 1.9 "199301" "1993" "19930102" "USA" "HTIELIGOV" "050" 1 3 1 3.5 "199301" "1993" "19930102" "USA" "IGOUNO" "036" 1 3 1 4 "199301" "1993" "19930102" "USA" "IGOUNOKIDLAB" "190" 2 6 4 -10 "199301" "1993" "19930102" "USA" "IRN" "042" 1 7 1 1.9 "199301" "1993" "19930102" "USA" "ISR" "061" 1 7 2 6.4 "199301" "1993" "19930102" "USA" "ISR" "070" 2 4 2 7 "199301" "1993" end
After every cameocode: The number of events that take place recorded in a observations is mentioned.
What I would like is: all events on a monthly basis for example for the 4 existing quadclasses.
every observations holds 1 or more events.
I tried:
egen Quadclass_1=sum(quadclass=="1"),by(YearMonth)
egen Quadclass_2=sum(quadclass=="2"),by(YearMonth)
egen Quadclass_3=sum(quadclass=="3"),by(YearMonth)
egen Quadclass_4=sum(quadclass=="4"),by(YearMonth)
egen Quadclass_2=sum(quadclass=="2"),by(YearMonth)
egen Quadclass_3=sum(quadclass=="3"),by(YearMonth)
egen Quadclass_4=sum(quadclass=="4"),by(YearMonth)
How can I add in the amount of events per observations?
thank you guys,
Comment