Hi, I am trying to reshape from wide to long, but it keeps saying that "variable id does not uniquely identify the observations". I am not sure why the variable ID is not uniquely identified as I generated ID using the code:

Code:
gen seq = _n
In full, this is what I coded and the error:
Code:
gen seq = _n
foreach v of varlist exalus-exvzus {
rename `v' u_`v'
}

reshape long u_, i(seq) j(country_pair_exchange) string
(note: j = exalus exauus exbeus exbzus excaus exchus exdnus execus exeuus exfnus exfrus exgeus exgrus exhkus exinus exirus exitus exjpus exkous exmaus exmxus exneus exnous exnzus expous exsdus exsfus exsius exslus exspus exszus extaus exthus exukus exusal exusec exuseu exusir exusnz exusuk exvzus)

variable id does not uniquely identify the observations
Your data are currently wide.  You are performing a reshape long. You
specified i(seq) and j(country_pair_exchange).  In the current wide form,
variable seq should uniquely identify the observations.  Remember this picture:

long                                wide

        +---------------+                   +------------------+

        | i   j   a   b |                   | i   a1 a2  b1 b2 |

        |---------------| <--- reshape ---> |------------------|

        | 1   1   1   2 |                   | 1   1   3   2  4 |

        | 1   2   3   4 |                   | 2   5   7   6  8 |

        | 2   1   5   6 |                   +------------------+

        | 2   2   7   8 |

        +---------------+

    Type reshape error for a list of the problem observations.

r(9);
The below are the data:
Code:
* Example generated by -dataex-. To install: ssc install dataex

clear

input double date float year str32 hcomnam double(ret sprtrn u_exusal u_exalus u_exbzus u_excaus u_exchus u_exdnus u_exhkus u_exinus u_exjpus)

14612 2000 "SELECT SECTOR SPDR TRUST"          -.019221041351556778 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CBIZ INC"                          -.014814814552664757 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "P G & E CORP"                       -.03658536449074745 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "E C I TELECOM LTD"                 -.003952569328248501 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ISHARES INC"                         .01937984488904476 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "P P L CORP"                        -.030054645612835884 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "TARRAGON CORP NEV"                 -.012195121496915817 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "VICOR CORPORATION"                 -.027006173506379128 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "D R S TECHNOLOGIES INC"             -.03896103799343109 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "PLAINS RESOURCES INC"               -.05999999865889549 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "WEST COAST BANCORP ORE NEW"         .004629629664123058 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "NATIONAL BANKSHARES INC"            .012658228166401386 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "AMERICAN WATER WORKS INC"            -.0117647061124444 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CALIFORNIA WATER SERVICE GROUP"     -.07422680407762527 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "BANK ONE CORP"                               -.02734375 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "AMWEST INSURANCE GROUP INC"                           0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "IVOW INC"                            .17499999701976776 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "MODTECH HOLDINGS INC"                .02083333395421505 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "IMPATH INC"                         .007371007464826107 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "MOORE WALLACE INC"                                    0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "PRIVATE MEDIA GROUP INC"              .0347222238779068 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "HEARTPORT INC"                       .07894736528396606 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "STRATEGIC GLOBAL INCOME FUND INC"                .03125 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CENTER TRUST INC"                   -.05806451663374901 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "AVIGEN INC"                       -.0030241934582591057 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "JO ANN STORES INC"                                    0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "STONEX GROUP INC"                  -.024390242993831635 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "TECH DATA CORP"                      -.0276497695595026 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "P C C GROUP INC"                     .23076923191547394 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "PLEXUS CORP"                       -.017045455053448677 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "STATEWIDE FINANCIAL CORP"          -.024752475321292877 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "MORGAN STANLEY TRUSTS"                                0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "SOUTHDOWN INC"                      -.04116222634911537 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "R P M INTERNATIONAL INC"           -.030674846842885017 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "MCRAE INDUSTRIES INC"                                 0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "RENAISSANCE LEARNING INC"           .044692736119031906 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "POTTERS FINANCIAL CORP"              .05263157933950424 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "KRATOS DEFENSE & SECUR SOLS INC"     .03295128792524338 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "PACIFIC GATEWAY PPTYS INC MD"                         0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "INTEGRITY MEDIA INC"                 .03999999910593033 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "SELECT SECTOR SPDR TRUST"          -.012211669236421585 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ABERDEEN ASIA PACIFIC INCOME FD"     .02469135820865631 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "THERMO INSTRUMENT SYSTEMS INC"                        0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "FIRST REGIONAL BANCORP"                               0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "MORTON INDUSTRIAL GROUP INC"                          0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "USURF AMERICA INC"                   .10294117778539658 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ARCH CAPITAL GROUP LTD NEW"          -.0891089141368866 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CAPSULE COMMUNICATIONS INC"          .02500000037252903 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "FEDDERS CORP"                       .022727273404598236 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "M C N ENERGY GROUP INC"            -.021052632480859756 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "FIELDWORKS INCORPORATED"                              0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "C T O REALTY GROWTH INC"           -.019607843831181526 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "EMVELCO CORP"                         .0810810774564743 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "L V M H MOET HENNESSY VUITTON"     -.012362637557089329 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "C B L & ASSOCIATES PPTYS INC"     -.0060606058686971664 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "BANKUNITED FINANCIAL CORP"          -.10236220806837082 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "NASHUA CORP"                         .01666666753590107 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "AMERITRANS CAPITAL CORP"            -.05511811003088951 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "THORATEC CORP"                      -.06410256773233414 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "JOURNAL REGISTER CO"                -.04048582911491394 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "NORTHERN TRUST CORP"                -.04775943234562874 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "STOLT NIELSEN S A"                  .035087719559669495 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CAROLINA SOUTHERN BK SPARTANBURG"    .03365384787321091 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "WORLD FUEL SERVICES CORP"                             0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "HOME STAKE OIL & GAS CO"                              0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CAPTEC NET LEASE REALTY INC"         .03333333507180214 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ACMAT CORP"                                           0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "BLACKROCK MUNIHLDGS NJ QLTY FD"     .005434782709926367 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CADILLAC FAIRVIEW CORP"             .010869565419852734 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ATRION CORP"                                          0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "T J INTERNATIONAL INC"            -.0007440476329065859 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "SYNTHETECH INC"                      .05000000074505806 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "D I S C INC"                        -.03030303120613098 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CONCERO INC"                       .0031347961630672216 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "TRIPOS INC"                         -.03804347664117813 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "MARKETING SPECIALISTS CORP"                           0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "KOLLMORGEN CORP"                   -.025380710139870644 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "A D C TELECOMMUNICATIONS INC"      -.000861326465383172 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "INTERLEAF INC"                      -.00929368007928133 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "EVANS & SUTHERLAND COMPUTER CORP"    .08743169158697128 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "CINTAS CORP"                       -.016470588743686676 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "AZUREL LTD"                          .06060606241226196 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "COHERENT INC"                       -.02570093423128128 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "T ROWE PRICE GROUP INC"            -.049069374799728394 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "E D P ENERGIAS DE PORTUGAL S A"     -.00358422938734293 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "INSIGHT HEALTH SERVICES CORP"         .1428571492433548 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "RELIANCE GROUP HOLDINGS INC"         .06603773683309555 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "RICHARDSON ELECTRONICS LTD"         -.03333333507180214 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ENGLOBAL CORP"                        .0714285746216774 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "BANK GRANITE CORP"                  -.06104651093482971 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "EASTERN ENTERPRISES"               -.007616974879056215 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ZIEGLER COMPANY INC"               -.012552301399409771 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "MERCHANTS NEW YORK BANCORP INC"    -.007299270015209913 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "PENN AMERICA GROUP INC"                               0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "PAIRGAIN TECHNOLOGIES INC"          -.04845815151929855 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "BROOKDALE LIVING COMM INC"          -.04040404036641121 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "D V I INC"                          -.02469135820865631 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "LIBERTY BANCORP INC NJ"                               0 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "ERICSSON"                            .03615604341030121 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

14612 2000 "COMVERSE TECHNOLOGY INC"             .06347150355577469 -.009549090000000001 .6591 1.5172204521316948 1.805 1.4465 8.2798 7.329 7.7765 43.55 101.7

end

format %td date
I typed in reshape error for the list of problem observations and it says "16928310 of 37899830 observations have duplicate i values". However, even after dropping the duplicates, it is still not working.

I am trying to achieve an output file with firm-year-country(host)-exchange_rates_coefficient-level and I was recommended to reshape the data from wide to long first. Am I writing the -reshape- command wrongly?