Announcement

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

  • Problem with spmap

    I am trying to draw a map of every department of Ecuador, taking into account the population of 2020. However, when trying to apply the command, the following message appears:

    variable i not found
    (error occurred while loading spmap_color.ado)

    I am using the following command:

    spmap year_2020 using "/Users/mendizabals/Desktop/provincias_coord.dta", id (Provincias_id)

    I am 100% sure that I have (Provincias_id) as variable in my database.

    Please, someone, help me to solve this problem.
    Last edited by Santiago Mendizabal; 06 Mar 2023, 10:41.

  • #2
    Oye, please read the FAQ section. We need a data example to help you. Please use the dataex command to show us what your dataex looks like.


    Also, please link the location of where you got your shapefiles from

    Comment


    • #3
      Dear Jared,

      Thanks for your kind response,

      Firstly, Here it is the way the dataex looks like:

      input byte Provincias_id str16 PROVINCIAS double(year_2010 year_2011 year_2012 year_2013 year_2014 year_2015 year_2016 year_2017 year_2018 year_2019 year_2020) byte _merge
      1 "AZUAY" 187891.8221863462 192296.16372154496 196765.20491435897 201281.88461698743 205840.33265914486 210434.0541767975 215060.84467984815 219711.33554967324 224399.1571236859 229105.53132957823 233840.79876365446 3
      2 "BOL�VAR" 25480.5044815889 26065.123637593148 26666.437822408854 27283.335042540228 27915.455911563677 28560.341724583985 29216.515919906502 29886.533524847953 30566.983761609627 31260.64008411936 31968.19622727161 3
      3 "CA�AR" 46967.00033264247 48669.83066906095 50429.97403746192 52241.37192665965 54097.05205683547 55998.2595877085 57942.517538160755 59924.777621479596 61947.303317799524 64002.73511818221 66095.07049836326 3
      4 "CARCHI" 41762.03137631414 42469.273098373546 43177.09230547564 43883.30488735696 44584.66111163409 45283.9329521967 45975.779782717414 46660.90958935732 47342.12868039939 48019.71237695357 48690.27389096744 3
      5 "COTOPAXI" 60311.819580183874 61970.71382173832 63672.62728256283 65416.62642553402 67198.8980786316 69022.81050253662 70882.07277077006 72779.53562005675 74712.94625319472 76685.39410090688 78695.40166119157 3
      6 "CHIMBORAZO" 92416.48554278752 93856.22814970426 95297.781444985 96731.58819595077 98157.83311827767 99568.8206617451 100970.47248315817 102354.58312382537 103722.4737401242 105076.75845505226 106413.73564394657 3
      7 "IMBABURA" 104518.65881113458 106721.50921491103 108961.88033149924 111228.8336999612 113517.54241576117 115819.85939503886 118142.48995169663 120469.06527978562 122802.94673439667 125137.7462876539 127475.17667029134 3
      8 "LOJA" 123987.25216499557 128167.52879179035 132363.06178745982 136547.3551905783 140713.33862097232 144843.3184819118 148925.6023473267 152950.81535564573 156913.98710537274 160801.59925061592 164605.6801555705 3
      9 "PICHINCHA" 886824.4604374063 899083.6472031111 910985.1532390612 922444.4300986613 933417.6048506718 943870.6706896353 953776.0641033568 963113.2550118159 971852.6641745019 979979.7244664575 987484.3714513545 3
      10 "TUNGURAHUA" 103517.82576024854 104323.72121515888 105139.4810325661 105954.90767470766 106759.99263498791 107555.65096391822 108334.07607102189 109100.61014118 109844.42205103787 110568.54630822198 111270.13776556641 3
      11 "SANTO DOMINGO" 136556.7857594906 140030.64580336455 143518.19043140643 147002.34027060977 150476.85870241467 153937.73723120466 157383.9804003983 160810.96103883334 164223.78079416076 167609.72830860858 170969.52377268192 3
      12 "EL ORO" 241431.3694480896 245340.06858508932 249210.55761873067 253035.17024926818 256806.2301730645 260522.18327683993 264189.92942693474 267807.2013497889 271370.2035451531 274881.29506278137 278342.08660931414 3
      13 "ESMERALDAS" 131837.57458482214 138542.99601924303 145385.2108830742 152319.5936573318 159314.85660140793 166328.8037552436 173329.58316219068 180280.01513788186 187156.37092285868 193929.22351325973 200571.5623472997 3
      14 "GUAYAS" 1573811.663754746 1599076.6893314486 1624360.6295015719 1649571.1062480693 1674676.9107776675 1699661.289537417 1724494.3705067663 1749171.7542650623 1773679.3776154818 1798012.8290789586 1822163.973935577 3
      15 "LOS R�OS" 214100.97466844795 218699.23056051377 223332.23927020154 227978.4008494075 232635.2693511534 237293.89026903582 241945.08000846303 246596.3576884984 251239.54795342428 255871.27000372097 260493.6683379283 3
      16 "MANAB�" 391161.79349938745 398862.34612832544 406547.96221288166 414176.4178449146 421724.0395808022 429194.60356247606 436568.06490311 443836.1914621461 450987.2567225043 458020.09254360065 464929.03846793657 3
      17 "SANTA ELENA" 88838.32865787653 90903.47491520496 92992.45689205313 95093.62722910423 97214.50106107455 99340.22536294037 101477.78256868891 103629.2244066747 105781.42826857539 107940.27896659568 110105.68507917314 3
      18 "MORONA SANTIAGO" 25851.341306320577 26680.303221307175 27514.736411422862 28352.653071674784 29191.046710366594 30031.261720913044 30872.967610106094 31718.865586698375 32565.25882498252 33412.147257374985 34257.49911781388 3
      19 "NAPO " 18102.980635901728 18650.180309499017 19218.53581971748 19796.55440064223 20383.351812599063 20980.075325256985 21586.862683098385 22202.11485706347 22825.935637480532 23461.24228100497 24104.650219414718 3
      20 "PASTAZA" 18674.47314529717 19292.123513187704 19926.74330126296 20569.399080878942 21226.15761332174 21895.7984123765 22576.225926743104 23270.52627649937 23975.298209023713 24692.767513332474 25419.511291123392 3
      21 "ZAMORA CHINCHIPE" 19109.709735660068 19883.54757847129 20677.519392297192 21493.87608108236 22332.916648635444 23192.029563964898 24072.189804222435 24970.576958449503 25885.904202822316 26818.9614155688 27767.90963113477 3
      22 "SUCUMB�OS" 37974.41892324707 39197.09314904988 40443.1089535739 41711.106449731655 43000.088658262444 44312.710555353806 45645.50344390303 46994.4854853442 48363.49749917639 49751.00895343724 51158.40215828944 3
      23 "ORELLANA" 28824.41378874819 30561.002961610837 32356.212366879983 34199.2347162689 36085.54350862164 38006.18995635576 39949.32901005222 41907.25795598083 43859.17730183461 45799.20281136325 47714.62353067838 3
      24 "" . . . . . . . . . . . 1
      25 "" . . . . . . . . . . . 1
      end
      label values _merge _merge
      label def _merge 1 "master only (1)", modify
      label def _merge 3 "matched (3)", modify
      [/CODE]
      ------------------ copy up to and including the previous line ------------------

      Listed 25 out of 25 observations

      Secondly, I got the shapefiles from the following location:

      https://drive.google.com/drive/folde...PUc-td8vl4h7P6





      Comment


      • #4
        Can you repost your dataex? I need it to look like this, formatted, so it's easy to work with. That is, should denote your code, so instead of

        gen a=1

        You see

        Code:
        gen a=1
        Or the gray box which formats it and your code correctly


        If it helps, watch this

        Comment


        • #5
          Thanks Jared,

          My data looks like this:

          Code:
          clear
          input byte Provincias_id str16 PROVINCIAS double year_2020
           1 "AZUAY"            233840.79876365446
           2 "BOL�VAR"           31968.19622727161
           3 "CA�AR"             66095.07049836326
           4 "CARCHI"            48690.27389096744
           5 "COTOPAXI"          78695.40166119157
           6 "CHIMBORAZO"       106413.73564394657
           7 "IMBABURA"         127475.17667029134
           8 "LOJA"              164605.6801555705
           9 "PICHINCHA"         987484.3714513545
          10 "TUNGURAHUA"       111270.13776556641
          11 "SANTO DOMINGO"    170969.52377268192
          12 "EL ORO"           278342.08660931414
          13 "ESMERALDAS"        200571.5623472997
          14 "GUAYAS"            1822163.973935577
          15 "LOS R�OS"          260493.6683379283
          16 "MANAB�"           464929.03846793657
          17 "SANTA ELENA"      110105.68507917314
          18 "MORONA SANTIAGO"   34257.49911781388
          19 "NAPO "            24104.650219414718
          20 "PASTAZA"          25419.511291123392
          21 "ZAMORA CHINCHIPE"  27767.90963113477
          22 "SUCUMB�OS"         51158.40215828944
          23 "ORELLANA"          47714.62353067838
          24 ""                                  .
          25 ""                                  .
          end
          Furthermore, this was the command that I applied,

          Code:
          spmap year_2020 using "/Users/mendizabals/Desktop/MAPA/provincias_coord.dta", id (Provincias_id)
          variable i not found
          (error occurred while loading spmap_color.ado)
          r(111);

          Comment

          Working...
          X