Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to add values from variable of one observation to another observation

    Trying to post this for the first time. Hoping the text shows...



    I'm trying to add the values from one variable for one observation to another observation. I have the following:



    obs;. char_state; char_county; yr; num_days

    51015; 51; 015; 2010; 2

    51017; 51; 017; 2010; 1

    51019; 51; 019; 2010; 3

    51021; 51; 021; 2010; 5

    .... .. ... .... .

    51515; 51; 515; 2010; 2



    I want to add the num_days value from 51515 (2) to the num_days value for 51019 (3) and 51017 (1) and get the new total of 5 for observation number 51019 and 3 for observation number 51017 and delete 51515, so I'd end up with:



    obs.; char_state; char_county; yr; num_days

    51015; 51; 015; 2010; 2

    51017; 51; 017; 2010; 3 (new total)

    51019; 51; 019; 2010; 5 (new total)

    51021; 51; 021; 2010; 5

    .... .. ... ... .

    51515 deleted from the table.



    Thanks!
    Last edited by Dr. Iqra Yaseen; 10 Sep 2022, 04:34.

  • #2
    Post some data sample using -dataex- so that whoever wants to help can see properly your data, and try on them.

    Comment


    • #3
      So this sample of data would something like this, using -dataex-

      Code:
      clear
      input long obs byte char_state int(char_county yr) byte num_days
      51015 51  15 2010 2
      51017 51  17 2010 1
      51019 51  19 2010 3
      51021 51  21 2010 5
      51515 51 515 2010 2
      end
      Sybil, I have a different question: could you state your problem in more general terms instead of with these specific observation numbers? It is hard to understand what is the general problem you are trying to solve.

      Comment


      • #4
        thanks @hemanshu for replying. so the general query is "to add value of one observation to another observation(s) for a single variable". e.g. i have a variable x with 5 observations. i want to add value of 5th observation to the value of 2nd and 4th observation and delete the 5th observation from the data set. hope this makes some sense now.
        Last edited by Dr. Iqra Yaseen; 12 Sep 2022, 00:05.

        Comment


        • #5
          sybil arqi the specific code will depend on the exact structure of the problem. Assuming you have many more observations than five, it would help to understand things like: (i) how are observations grouped (say by which variable or combination of variables)? (ii) are the groups always of five members, and in each group of five you want to add the value of the 5th to the 2nd and 4th, and then drop the 5th? or is there some other way the respective observations you want to operate on, are identified in each group? (iii) do you want to operate on one variable or multiple?

          It would also help to have a proper data example, as requested in #2.

          Comment


          • #6
            To take your question very literally, this code would do it:
            Code:
            replace num_days = num_days + num_days[5] if inlist(_n,2,4)
            drop in 5
            But this code may not be very helpful for the actual problem you are trying to solve.

            Comment


            • #7
              thanks once again Hemanshu Kumar , will try this code with modifications as per my specific problem. in case the modified code fails will revert back to you. thanks once again.

              Comment


              • #8
                Code:
                * Example generated by -dataex-. To install: ssc install dataex
                clear
                 year  iso3_o  disputes
                1995 "BEL"   0
                1995 "IRL"   0
                1995 "BEL"   0
                1995 "GRC"   0
                1995 "CHE"   0
                1995 "USA"   2
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "NOR"   0
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "HUN"   0
                1995 "CHE"   0
                1995 "FRA"   0
                1995 "CHE"   0
                1995 "CAN"   2
                1995 "CHE"   0
                1995 "EU"    2
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "AUS " 0
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "DNK"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "USA"   2
                1995 "BEL"   0
                1995 "NZL"   0
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "USA"   2
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "EU"    2
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "ISL"   0
                1995 "AUS " 1
                1995 "BEL"   0
                1995 "DEU"   0
                1995 "MLT"   0
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "EU"    2
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "EU"    2
                1995 "ROU"   0
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "AUS"   1
                1995 "ESP"   0
                1995 "CAN"   1
                1995 "PRT"   0
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "CAN"   1
                1995 "BEL"   0
                1995 "AUT"   0
                1995 "JPN"   2
                1995 "BEL"   0
                1995 "SWE"   0
                1995 "CHE"   0
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "CHE"   0
                1995 "BEL"   0
                1995 "ITA"   0
                1995 "SVK " 0
                1995 "BEL"   0
                1995 "CZE"   0
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "POL"   0
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "JPN"   1
                1995 "BEL"   0
                1995 "BEL"   0
                1995 "GBR"   0
                1995 "CHE"   0
                end
                format %ty year
                so Hemanshu Kumar, this is the actual dataset i am working on. the variable "year" is the year in which a dispute was initiated, iso3_o is the country code and disputes is the number of disputes initiated for that year. now I want to take the value of disputes (variable disputes) from EU (variable iso3_o) and add it to dispute value of e.g. GRC, BEL and POL and i want to do if for year 1995 seperately, year 1996 seperately upto year 2019.

                Comment


                • #9
                  Try this:
                  Code:
                  bys year: egen EU_disputes = total(disputes*(iso3_o == "EU"))
                  gen total_disputes = disputes 
                  replace total_disputes = disputes + EU_disputes if inlist(iso3_o,"GRC","BEL","POL")
                  drop if iso3_o == "EU"
                  You had multiple observations for "EU" in the same year. I have created a variable that adds those numbers up. If you would like to do something different, you may need to change the code in the first line.

                  Comment


                  • #10
                    thank you so much Hemanshu Kumar. one confusion still persists and that is about the variable "year". as already specified, i need the code that will add the said variable for different years separately. although being new to STATA and perfectly unaware of the code given by you, but, from whatever knowledge I have gained till now, the first line of your code will add all disputes related to EU from 1995 to 2019, but what I need is to add EU disputes annually and then distribute them to the said countries pertaining to that particular year.

                    Comment


                    • #11
                      Hemanshu Kumar thank you the code worked.....but i have another somewhat related query. hope will get the same response as for the previous one. the example dataset ias as
                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      year   iso3_o iso3_d disputes
                      1995 "POL" "DNK" 0
                      1995 "GRC" "EU"  0
                      1995 "POL" "LVA" 0
                      1995 "POL" "MLT" 0
                      1995 "GRC" "USA" 0
                      1995 "EU"  "NZL" 0
                      1995 "POL" "AUS" 0
                      1995 "EU"  "ROU" 0
                      1995 "POL" "ISL" 0
                      1995 "GRC" "ITA" 0
                      1995 "GRC" "LUX" 0
                      1995 "POL" "ALB" 0
                      1995 "GRC" "ALB" 0
                      1995 "EU"  "JPN" 2
                      1995 "POL" "BEL" 0
                      1995 "GRC" "PRT" 0
                      1995 "POL" "ROU" 0
                      1995 "GRC" "ISR" 0
                      1995 "EU"  "HUN" 0
                      1995 "POL" "HRV" 0
                      1995 "EU"  "GRC" 0
                      1995 "GRC" "UKR" 0
                      1995 "GRC" "CHE" 0
                      1995 "EU"  "DEU" 0
                      1995 "POL" "UKR" 0
                      1995 "GRC" "LVA" 0
                      1995 "GRC" "AUT" 0
                      1995 "EU"  "SWE" 0
                      1995 "GRC" "FIN" 0
                      1995 "GRC" "SVK" 0
                      1995 "POL" "USA" 0
                      1995 "GRC" "SWE" 0
                      1995 "GRC" "NOR" 0
                      1995 "EU"  "AUS" 0
                      1995 "POL" "MNE" 0
                      1995 "EU"  "CAN" 2
                      1995 "GRC" "SVN" 0
                      1995 "POL" "ISR" 0
                      1995 "POL" "GBR" 0
                      1995 "GRC" "AUS" 0
                      1995 "GRC" "MLT" 0
                      1995 "EU"  "IRL" 0
                      1995 "EU"  "FRA" 0
                      1995 "EU"  "JPN" 2
                      1995 "GRC" "NLD" 0
                      1995 "GRC" "ESP" 0
                      1995 "GRC" "GBR" 0
                      1995 "POL" "NZL" 0
                      1995 "GRC" "NZL" 0
                      1995 "POL" "ITA" 0
                      1995 "EU"  "USA" 2
                      1995 "POL" "MKD" 0
                      1995 "GRC" "MDA" 0
                      1995 "POL" "AUT" 0
                      1995 "GRC" "DNK" 0
                      1995 "EU"  "ESP" 0
                      1995 "EU"  "GBR" 0
                      1995 "POL" "RUS" 0
                      1995 "POL" "JPN" 0
                      1995 "GRC" "EST" 0
                      1995 "GRC" "MNE" 0
                      1995 "POL" "CAN" 0
                      1995 "POL" "IRL" 0
                      1995 "POL" "HUN" 0
                      1995 "GRC" "ROU" 0
                      1995 "GRC" "MKD" 0
                      1995 "POL" "BGR" 0
                      1995 "GRC" "CAN" 0
                      1995 "POL" "SVN" 0
                      1995 "EU"  "DNK" 0
                      1995 "EU"  "POL" 0
                      1995 "POL" "PRT" 0
                      1995 "POL" "LTU" 0
                      1995 "GRC" "ISL" 0
                      1995 "GRC" "POL" 0
                      1995 "POL" "LUX" 0
                      1995 "GRC" "LTU" 0
                      1995 "POL" "SVK" 0
                      1995 "GRC" "RUS" 0
                      1995 "POL" "EU"  0
                      1995 "POL" "CHE" 0
                      1995 "GRC" "CYP" 0
                      1995 "EU"  "ITA" 0
                      1995 "EU"  "BEL" 0
                      1995 "POL" "NOR" 0
                      1995 "EU"  "NLD" 0
                      1995 "POL" "MDA" 0
                      1995 "POL" "EST" 0
                      1995 "GRC" "JPN" 0
                      1995 "GRC" "BEL" 0
                      1995 "GRC" "DEU" 0
                      1995 "GRC" "BGR" 0
                      1995 "POL" "ESP" 0
                      1995 "EU"  "CZE" 0
                      1995 "GRC" "HUN" 0
                      1995 "GRC" "IRL" 0
                      1995 "POL" "DEU" 0
                      1995 "POL" "GRC" 0
                      1995 "POL" "CYP" 0
                      1995 "POL" "NLD" 0
                      end
                      format %ty year
                      here a new variable iso3_d has been included. it is also a country code variable but here d stands for destination country. now what i need is to take the dispute total from observation with EU from iso3_o and "JPN" from iso3_d and add that value to observation with "GRC" from iso3_o & "JPN" from iso3_d and "POL" from iso3_o and "JPN" from iso3_d for year 1995. the simple thing is that i want to distribute disputes initiated by EU against other country into the EU member countries against the same opponent as that of EU.
                      extremely sorry for quering again and again. i may look stupid but i have no other option than asking you.
                      thanks. May God bless you

                      Comment


                      • #12
                        Just change the first line of the code I gave you in #9, to:
                        Code:
                        bys year iso3_d: egen EU_disputes = total(disputes*(iso3_o == "EU"))
                        The rest of the code is the same. I think this should give you what you want.

                        Comment


                        • #13
                          thank you Hemanshu Kumar . the code worked....super happy

                          Comment


                          • #14
                            Hemanshu Kumar Joro Kolev this is my example dataset
                            Code:
                            * Example generated by -dataex-. To install: ssc install dataex
                            clear
                            input int year str212 ProductSector str33 iso3_o
                            2010 "HS - 2602 - Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20 % or more, calculated on the dry weight."                                           "Albania"                        
                            2010 "HS - 2610 - Chromium ores and concentrates."                                                                                                                                                                          "Albania"                        
                            2010 "HS - 282560 - Germanium oxides and zirconium dioxide"                                                                                                                                                                 "Algeria"                        
                            2010 "HS - 2602 - Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20 % or more, calculated on the dry weight."                                           "Angola"                         
                            2010 "HS - 283691 - Lithium carbonates"                                                                                                                                                                                     "Argentina"                      
                            2010 "HS - 2602 - Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20 % or more, calculated on the dry weight."                                           "Argentina"                      
                            2010 "HS - 2603 - Copper ores and concentrates."                                                                                                                                                                            "Argentina"                      
                            2010 "HS - 282530 - Vanadium oxides and hydroxides"                                                                                                                                                                         "Argentina"                      
                            2010 "HS - 2835 - Phosphinates (hypophosphites), phosphonates (phosphites) and phosphates; polyphosphates, whether or not chemically defined."                                                                              "Argentina"                      
                            2010 "HS - 2810 - Oxides of boron; boric acids."                                                                                                                                                                            "Argentina"                      
                            2010 "HS - 2603 - Copper ores and concentrates."                                                                                                                                                                            "Armenia"                        
                            2010 "HS - 282540 - Nickel oxides and hydroxides"                                                                                                                                                                           "Australia"                      
                            2010 "HS - 2605 - Cobalt ores and concentrates."                                                                                                                                                                            "Australia"                      
                            2010 "HS - 2616 - Precious metal ores and concentrates."                                                                                                                                                                    "Australia"                      
                            2010 "HS - 2819 - Chromium oxides and hydroxides."                                                                                                                                                                          "Australia"                      
                            2010 "HS - 2820 - Manganese oxides."                                                                                                                                                                                        "Australia"                      
                            2010 "HS - 261710 - Antimony ores and concentrates"                                                                                                                                                                         "Australia"                      
                            2010 "HS - 8112 - Beryllium, chromium, germanium, vanadium, gallium, hafnium, indium, niobium (columbium), rhenium and thallium, and articles of these metals, including waste and scrap."                                  "Australia"                      
                            2010 "HS - 2615 - Niobium, tantalum, vanadium or zirconium ores and concentrates."                                                                                                                                          "Australia"                      
                            2010 "HS - 282520 - Lithium oxide and hydroxide"                                                                                                                                                                            "Australia"                      
                            2010 "HS - 2835 - Phosphinates (hypophosphites), phosphonates (phosphites) and phosphates; polyphosphates, whether or not chemically defined."                                                                              "Australia"                      
                            2010 "HS - 2848 - Phosphides, whether or not chemically defined, excluding ferrophosphorus."                                                                                                                                "Australia"                      
                            2010 "HS - 2602 - Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20 % or more, calculated on the dry weight."                                           "Australia"                      
                            2010 "HS - 2611 - Tungsten ores and concentrates."                                                                                                                                                                          "Australia"                      
                            2010 "HS - 282560 - Germanium oxides and zirconium dioxide"                                                                                                                                                                 "Australia"                      
                            2010 "HS - 2816 - Hydroxide and peroxide of magnesium; oxides, hydroxides and peroxides, of strontium or barium."                                                                                                           "Australia"                      
                            2010 "HS - 2504 - Natural graphite."                                                                                                                                                                                        "Australia"                      
                            2010 "HS - 2810 - Oxides of boron; boric acids."                                                                                                                                                                            "Australia"                      
                            2010 "HS - 2604 - Nickel ores and concentrates."                                                                                                                                                                            "Australia"                      
                            2010 "HS - 282580 - Antimony oxides"                                                                                                                                                                                        "Australia"                      
                            2010 "HS - 2603 - Copper ores and concentrates."                                                                                                                                                                            "Australia"                      
                            2010 "HS - 2610 - Chromium ores and concentrates."                                                                                                                                                                          "Australia"                      
                            2010 "HS - 2519 - Natural magnesium carbonate (magnesite); fused magnesia; deadburned (sintered) magnesia, whether or not containing small quantities of other oxides added before sintering; other magnesium oxide, wheth" "Australia"                      
                            2010 "HS - 282560 - Germanium oxides and zirconium dioxide"                                                                                                                                                                 "Austria"                        
                            2010 "HS - 283691 - Lithium carbonates"                                                                                                                                                                                     "Austria"                        
                            2010 "HS - 2610 - Chromium ores and concentrates."                                                                                                                                                                          "Austria"                        
                            2010 "HS - 2615 - Niobium, tantalum, vanadium or zirconium ores and concentrates."                                                                                                                                          "Austria"                        
                            2010 "HS - 2603 - Copper ores and concentrates."                                                                                                                                                                            "Austria"                        
                            2010 "HS - 2519 - Natural magnesium carbonate (magnesite); fused magnesia; deadburned (sintered) magnesia, whether or not containing small quantities of other oxides added before sintering; other magnesium oxide, wheth" "Austria"                        
                            2010 "HS - 2822 - Cobalt oxides and hydroxides; commercial cobalt oxides."                                                                                                                                                  "Austria"                        
                            2010 "HS - 2604 - Nickel ores and concentrates."                                                                                                                                                                            "Austria"                        
                            2010 "HS - 261710 - Antimony ores and concentrates"                                                                                                                                                                         "Austria"                        
                            2010 "HS - 2504 - Natural graphite."                                                                                                                                                                                        "Austria"                        
                            2010 "HS - 282530 - Vanadium oxides and hydroxides"                                                                                                                                                                         "Austria"                        
                            2010 "HS - 2816 - Hydroxide and peroxide of magnesium; oxides, hydroxides and peroxides, of strontium or barium."                                                                                                           "Austria"                        
                            2010 "HS - 8112 - Beryllium, chromium, germanium, vanadium, gallium, hafnium, indium, niobium (columbium), rhenium and thallium, and articles of these metals, including waste and scrap."                                  "Austria"                        
                            2010 "HS - 2835 - Phosphinates (hypophosphites), phosphonates (phosphites) and phosphates; polyphosphates, whether or not chemically defined."                                                                              "Austria"                        
                            2010 "HS - 2602 - Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20 % or more, calculated on the dry weight."                                           "Bahrain, Kingdom of"            
                            2010 "HS - 2504 - Natural graphite."                                                                                                                                                                                        "Bahrain, Kingdom of"            
                            2010 "HS - 2835 - Phosphinates (hypophosphites), phosphonates (phosphites) and phosphates; polyphosphates, whether or not chemically defined."                                                                              "Bahrain, Kingdom of"            
                            2010 "HS - 282560 - Germanium oxides and zirconium dioxide"                                                                                                                                                                 "Bahrain, Kingdom of"            
                            2010 "HS - 2615 - Niobium, tantalum, vanadium or zirconium ores and concentrates."                                                                                                                                          "Bahrain, Kingdom of"            
                            2010 "HS - 2816 - Hydroxide and peroxide of magnesium; oxides, hydroxides and peroxides, of strontium or barium."                                                                                                           "Bangladesh"                     
                            2010 "HS - 2848 - Phosphides, whether or not chemically defined, excluding ferrophosphorus."                                                                                                                                "Bangladesh"                     
                            2010 "HS - 282530 - Vanadium oxides and hydroxides"                                                                                                                                                                         "Barbados"                       
                            2010 "HS - 261710 - Antimony ores and concentrates"                                                                                                                                                                         "Belgium"                        
                            2010 "HS - 2816 - Hydroxide and peroxide of magnesium; oxides, hydroxides and peroxides, of strontium or barium."                                                                                                           "Belgium"                        
                            2010 "HS - 2835 - Phosphinates (hypophosphites), phosphonates (phosphites) and phosphates; polyphosphates, whether or not chemically defined."                                                                              "Belgium"                        
                            2010 "HS - 2819 - Chromium oxides and hydroxides."                                                                                                                                                                          "Belgium"                        
                            2010 "HS - 2610 - Chromium ores and concentrates."                                                                                                                                                                          "Belgium"                        
                            2010 "HS - 2602 - Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20 % or more, calculated on the dry weight."                                           "Belgium"                        
                            2010 "HS - 2504 - Natural graphite."                                                                                                                                                                                        "Belgium"                        
                            2010 "HS - 282530 - Vanadium oxides and hydroxides"                                                                                                                                                                         "Belgium"                        
                            2010 "HS - 283691 - Lithium carbonates"                                                                                                                                                                                     "Belgium"                        
                            2010 "HS - 282520 - Lithium oxide and hydroxide"                                                                                                                                                                            "Belgium"                        
                            2010 "HS - 282580 - Antimony oxides"                                                                                                                                                                                        "Belgium"                        
                            2010 "HS - 8112 - Beryllium, chromium, germanium, vanadium, gallium, hafnium, indium, niobium (columbium), rhenium and thallium, and articles of these metals, including waste and scrap."                                  "Belgium"                        
                            2010 "HS - 2604 - Nickel ores and concentrates."                                                                                                                                                                            "Belgium"                        
                            2010 "HS - 2615 - Niobium, tantalum, vanadium or zirconium ores and concentrates."                                                                                                                                          "Belgium"                        
                            2010 "HS - 2611 - Tungsten ores and concentrates."                                                                                                                                                                          "Belgium"                        
                            2010 "HS - 2519 - Natural magnesium carbonate (magnesite); fused magnesia; deadburned (sintered) magnesia, whether or not containing small quantities of other oxides added before sintering; other magnesium oxide, wheth" "Belgium"                        
                            2010 "HS - 282560 - Germanium oxides and zirconium dioxide"                                                                                                                                                                 "Belgium"                        
                            2010 "HS - 2810 - Oxides of boron; boric acids."                                                                                                                                                                            "Belgium"                        
                            2010 "HS - 2820 - Manganese oxides."                                                                                                                                                                                        "Belgium"                        
                            2010 "HS - 283692 - Strontium carbonate"                                                                                                                                                                                    "Belgium"                        
                            2010 "HS - 282540 - Nickel oxides and hydroxides"                                                                                                                                                                           "Belgium"                        
                            2010 "HS - 2822 - Cobalt oxides and hydroxides; commercial cobalt oxides."                                                                                                                                                  "Belgium"                        
                            2010 "HS - 2819 - Chromium oxides and hydroxides."                                                                                                                                                                          "Bhutan"                         
                            2010 "HS - 2504 - Natural graphite."                                                                                                                                                                                        "Bhutan"                         
                            2010 "HS - 261710 - Antimony ores and concentrates"                                                                                                                                                                         "Bolivia, Plurinational State of"
                            2010 "HS - 282580 - Antimony oxides"                                                                                                                                                                                        "Bolivia, Plurinational State of"
                            2010 "HS - 2615 - Niobium, tantalum, vanadium or zirconium ores and concentrates."                                                                                                                                          "Bolivia, Plurinational State of"
                            2010 "HS - 2603 - Copper ores and concentrates."                                                                                                                                                                            "Bosnia and Herzegovina"         
                            2010 "HS - 2616 - Precious metal ores and concentrates."                                                                                                                                                                    "Botswana"                       
                            2010 "HS - 2603 - Copper ores and concentrates."                                                                                                                                                                            "Botswana"                       
                            2010 "HS - 8112 - Beryllium, chromium, germanium, vanadium, gallium, hafnium, indium, niobium (columbium), rhenium and thallium, and articles of these metals, including waste and scrap."                                  "Brazil"                         
                            2010 "HS - 2610 - Chromium ores and concentrates."                                                                                                                                                                          "Brazil"                         
                            2010 "HS - 2519 - Natural magnesium carbonate (magnesite); fused magnesia; deadburned (sintered) magnesia, whether or not containing small quantities of other oxides added before sintering; other magnesium oxide, wheth" "Brazil"                         
                            2010 "HS - 2835 - Phosphinates (hypophosphites), phosphonates (phosphites) and phosphates; polyphosphates, whether or not chemically defined."                                                                              "Brazil"                         
                            2010 "HS - 2616 - Precious metal ores and concentrates."                                                                                                                                                                    "Brazil"                         
                            2010 "HS - 2602 - Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20 % or more, calculated on the dry weight."                                           "Brazil"                         
                            2010 "HS - 2603 - Copper ores and concentrates."                                                                                                                                                                            "Brazil"                         
                            2010 "HS - 2504 - Natural graphite."                                                                                                                                                                                        "Brazil"                         
                            2010 "HS - 2820 - Manganese oxides."                                                                                                                                                                                        "Brazil"                         
                            2010 "HS - 2611 - Tungsten ores and concentrates."                                                                                                                                                                          "Brazil"                         
                            2010 "HS - 282530 - Vanadium oxides and hydroxides"                                                                                                                                                                         "Brazil"                         
                            2010 "HS - 2519 - Natural magnesium carbonate (magnesite); fused magnesia; deadburned (sintered) magnesia, whether or not containing small quantities of other oxides added before sintering; other magnesium oxide, wheth" "Brunei Darussalam"              
                            2010 "HS - 8112 - Beryllium, chromium, germanium, vanadium, gallium, hafnium, indium, niobium (columbium), rhenium and thallium, and articles of these metals, including waste and scrap."                                  "Bulgaria"                       
                            2010 "HS - 2835 - Phosphinates (hypophosphites), phosphonates (phosphites) and phosphates; polyphosphates, whether or not chemically defined."                                                                              "Bulgaria"                       
                            2010 "HS - 283692 - Strontium carbonate"                                                                                                                                                                                    "Bulgaria"                       
                            end
                            here i want to add values specific to variable "ProductSector" that contains a some common condition. e.g i intend to add values for "ProductSector" that contains "cobalt" and add up all those values under a new variable that has "cobalt" one of the string value.

                            Comment

                            Working...
                            X