Announcement

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

  • error message invalid dBASE when converting Eurostat shapefile into dta

    Dears

    I try to convert the shapefiles contained in the zip file from: http://ec.europa.eu/eurostat/web/gis...cal-units/nuts

    into .dta files. I have downloaded the SHP zip (NUTs 2016 ) and when converting into dta I always get the same error message :

    Code:
    shp2dta using "mydir\NUTS_BN_10M_2010_3035_LEVL_3", data("mydir\dta\NUTS_BN_10M_2010_3035_LEVL_3.dta") coord("mydir\dta\NUTS_BN_10M_2010_3035_LEVL_3_coor.dta") genid(id) gencentroids(cc) replace
    type: 3
    mydir\NUTS_BN_10M_2010_3035_LEVL_3.dbf: invalid dBASE data type

    Could you please help me to understand what the problem might be?

    Thank you in advance

    Federica

  • #2
    I get the same and have no idea why. However, if you are on Stata 15, you could try:

    Code:
    spshape2dta "mydir\NUTS_BN_10M_2010_3035_LEVL_3"

    Comment


    • #3
      I have already tried but since I have stata 14 it is not working.
      Thanks anyway

      Comment


      • #4
        Not sure how often you will do this, but you could do the following:
        open your dbf in excel
        save as xls or xlsx
        import the xls or xlsx into stata
        export as dbf, and overwrite the original dbf file

        re-run your code above.


        Seems shp2dta or the functions it relies on cannot handle the file format used by Eurostat? (dBase v7?) Anyone have any idea?
        Last edited by Jorrit Gosens; 11 Jul 2018, 08:52.

        Comment


        • #5
          Ok Thanks I will try it

          Comment


          • #6
            Actually, you could also try importing the dbf file, and exporting it as a dbf with the same name, all within Stata. That would help reproducibility.
            A little surpised that that worked.

            Comment


            • #7
              I tried with one of the dbf file, but probably the command I use is not correct
              Code:
              odbc insert, table("nydir\NUTS_RG_BN_10M_2010") dsn("NUTS_RG_10M_2010_3035") create
              The ODBC driver reported the following diagnostics
              [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
              SQLSTATE=IM002
              Another question shall I run the same command for all the 40 (may be more) dbf files? Then let's see if it is possible to do it in a loop.
              Thanks

              Federica

              Comment


              • #8
                You can do:
                Code:
                import dbase using NUTS_BN_10M_2016_3035_LEVL_3.dbf, clear
                export dbase using NUTS_BN_10M_2016_3035_LEVL_3.dbf, replace
                No need for ODBC tools.
                And yes, this would be possible in a loop:

                Code:
                local myfilelist : dir . files "*.dbf"
                foreach file of local myfilelist {
                import dbase using `file', clear
                export dbase using `file', replace
                }

                Comment

                Working...
                X