Hello, My table1 looks like this: LenderID Year Ind1 Ind2 Ind3 Ind4 Ind5 Ind6 Ind7 Ind8 Ind9 Ind10 1 1995 0,2 0,3 0,1 0,05 0,05 0,025 0,025 0,07 0,08 0,1 2 1995 0,025 0,025 0,025 0,025 0,025 0,030 0,5 0,15 0,05 0,145 3 1995 0,07 0,08 0,09 0,1 0,11 0,12 0,13 0,14 0,15 0,01 4 1995 0,08 0,24 0,29 0,13 0,05 0,04 0,06 0,07 0,02 0,02 … … … … … … … … … … … … The summation of Indi, (i=1, 2, ..., 10) egals 1 (100%) I want that the five industries with the most weights be selected in the table2. Table2 looks like this: PackageID LenderID year Ind1 Ind2 Ind3 Ind4 Ind5 Ind6 Ind7 Ind8 Ind9 Ind10 1 56 1995 0 1 0 0 0 0 0 0 0 0 1 1 1995 0 1 0 0 0 0 0 0 0 0 1 2 1995 0 1 0 0 0 0 0 0 0 0 2 4 1995 0 0 0 0 0 0 0 1 0 0 2 6 1995 0 0 0 0 0 0 0 1 0 0 2 3 1995 0 0 0 0 0 0 0 1 0 0 2 108 1995 0 0 0 0 0 0 0 1 0 0 … … … … … … … … … … … … … I have in this table ten binary variables for each industry. For example, if the borrower's industry is Ind1 then Ind1 is 1, otherwise 0. I have approximately 125 000 packageIDs in which one to fifty lenders (LenderID is the identification number) can be present. In total, 70 000 lenders are active (i.e. they participate frequently). Table1 gives me the information about weights in each industry. I want keep lenderIDs in table2 that corresponds to their five industries with the most important industries' weights.in table1. I also have 18 years so the years must match between the two tables. For example, if we look at the packageID 1 with the information we see in table1, LenderID 1 can keep his place in table2, LenderID 2 must be eliminated and so on. That seems complex to code. Thanks for your help.
... View more