Hej Statalist,

I have a problem with dropping some observations. I analyse a trade data set and have a lot of missing data for the trade value, as I have observations for every combination of reporter partner commodity and year. My data consists of 686,760 observation and 664,327 of these are missing. In the displayed data set for all observations trade is zero, furthermore I only have two partner countries (BEN, GIN), but all other countries as reporters.
Code:
year reporter partner commodity                                        tradevalueus
1992 "VNM" "BEN" "Albuminoids, modified starches, glues, enzymes"         .
1992 "CYP" "BEN" "Wool, animal hair, horsehair yarn and fabric thereof"   .
1992 "NOR" "BEN" "Glass and glassware"                                    .
1992 "MAR" "BEN" "Furskins and artificial fur, manufactures thereof"      .
1992 "GIN" "BEN" "Optical, photo, technical, medical, etc apparatus"      .
1992 "MAC" "BEN" "Manufactures of plaiting material, basketwork, etc."    .
1992 "BEN" "BEN" "Residues, wastes of food industry, animal fodder"       .
1992 "BLR" "BEN" "Residues, wastes of food industry, animal fodder"       .
1992 "BEN" "BEN" "Nickel and articles thereof"                            .
1992 "COL" "BEN" "Fertilizers"                                            .
1992 "ITA" "BEN" "Other made textile articles, sets, worn clothing etc"   .
1992 "MOZ" "BEN" "Arms and ammunition, parts and accessories thereof"     .
1992 "MOZ" "BEN" "Copper and articles thereof"                            .
1992 "MOZ" "BEN" "Cork and articles of cork"                              .
1992 "MSR" "BEN" "Miscellaneous edible preparations"                      .
1992 "NER" "BEN" "Nuclear reactors, boilers, machinery, etc"              .
1992 "KHM" "BEN" "Oil seed, oleagic fruits, grain, seed, fruit, etc, ne"  .
1992 "GUY" "BEN" "Tobacco and manufactured tobacco substitutes"           .
1992 "SWE" "BEN" "Tanning, dyeing extracts, tannins, derivs,pigments et"  .
1992 "BMU" "BEN" "Fish, crustaceans, molluscs, aquatic invertebrates ne"  .
1992 "MKD" "BEN" "Meat and edible meat offal"                             .
1992 "SYC" "BEN" "Fish, crustaceans, molluscs, aquatic invertebrates ne"  .
1992 "BMU" "BEN" "Meat, fish and seafood food preparations nes"           .
1992 "HUN" "BEN" "Products of animal origin, nes"                         .
1992 "PSE" "BEN" "Ores, slag and ash"                                     .
1992 "SRB" "BEN" "Carpets and other textile floor coverings"              .
1992 "AUT" "BEN" "Inorganic chemicals, precious metal compound, isotope"  .
1992 "LKA" "BEN" "Cork and articles of cork"                              .
1992 "CPV" "BEN" "Vegetable, fruit, nut, etc food preparations"           .
1992 "MKD" "BEN" "Copper and articles thereof"                            .
1992 "AUS" "BEN" "Nickel and articles thereof"                            .
1992 "LBY" "BEN" "Plastics and articles thereof"                          .
1992 "COG" "BEN" "Mineral fuels, oils, distillation products, etc"        .
1992 "BRA" "BEN" "Live animals"                                           .           .
I want to drop all the observations where there was no trade in a commodity between the partner and reporter in the last 5 years.
As I googled, people suggested using foreach, but only for one condition, I couldn't figure out how to do it under several coniditions.
So I would be really pleased if someone could help me out. Thank you very much in advance for your help.

Martin