Hello Everyone,

I have data that runs monthly and each observation is a national troop contribution to a UN peacekeeping mission by month--year and by the type of contribution (troops, observers, police etc). A sample of the data is below so that you can see my variables of interest.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str10 date int year byte month int monthcount str41 contributor long mission1 float(troops1 observers1 monusco tokencontributor)
"1990-11-30" 1990 11 11 "Argentina"  21  29 . . 0
"1990-11-30" 1990 11 11 "Argentina"  32   6 . . 0
"1990-11-30" 1990 11 11 "Argentina"  82   4 . . 0
"1990-11-30" 1990 11 11 "Australia"  36   . . . 0
"1990-11-30" 1990 11 11 "Australia"  39   2 . . 0
"1990-11-30" 1990 11 11 "Australia"  82  13 . . 0
"1990-11-30" 1990 11 11 "Austria"    35 532 . . 0
"1990-11-30" 1990 11 11 "Austria"    36 410 . . 0
"1990-11-30" 1990 11 11 "Austria"    39  11 . . 0
"1990-11-30" 1990 11 11 "Austria"    82  14 . . 0
"1990-11-30" 1990 11 11 "Belgium"    56   2 . . 0
"1990-11-30" 1990 11 11 "Belgium"    82   2 . . 0
"1990-11-30" 1990 11 11 "Bangladesh" 39   5 . . 0
"1990-11-30" 1990 11 11 "Brazil"     21  21 . . 0
"1990-11-30" 1990 11 11 "Brazil"     32   6 . . 0
"1990-11-30" 1990 11 11 "Canada"     21 172 . . 0
"1990-11-30" 1990 11 11 "Canada"     35 230 . . 0
"1990-11-30" 1990 11 11 "Canada"     36 573 . . 0
"1990-11-30" 1990 11 11 "Canada"     39   8 . . 0
"1990-11-30" 1990 11 11 "Canada"     82  19 . . 0
end
label values mission1 mission1
label def mission1 21 "ONUCA", modify
label def mission1 32 "UNAVEM", modify
label def mission1 35 "UNDOF", modify
label def mission1 36 "UNFICYP", modify
label def mission1 39 "UNIIMOG", modify
label def mission1 56 "UNMOGIP", modify
label def mission1 82 "UNTSO", modify
I'm fairly new to Stata, but I would like to know the maximum troop and observer contributions (troops1, observers1) for each country for each mission by year so that I can graph/display the change for a certain mission (variable monusco) over time given the condition that the max value makes the country a token contributor (variable tokencontributor= 1 if troops1<40 & observers1<10).

I'm having trouble isolating the maximum contributions per year or contributions by country by mission by year according to a specific rule like the one for the tokencontributor variable. I thought a dummy variable might be the best way to do this (x= 1 if max value of troops1<40 & observers1<10 for each year) but I'm open to other options. I was hesitant to reshape because I want the max contribution per year rather than the total but perhaps that's an option I'm unaware of?

Note: countries might contribute to a single mission every month of a given year or multiple months of a year, sometimes with different levels of troops or observers. Data runs from 1990-2018.

Thank you in advance for any help you can provide and please let me know if something isn't clear.