Error in reading DBF

In Fun with maps in Stata I noted an error that occurs when trying to convert shapefiles from PhilGIS to Stata data files using -shp2dta- (Kevin Crow). It turns out that the column widths are more than 244 (even though the strings in the cells are not long). The easiest way to get around this is to open the dbf file using another program and change the column widths.[1] In my case, I used MS Excel.[2] If you are using Excel 2003, there is a ‘save as dbf’ option. But for some reason, this option is not available in Excel 2007 (what were the geniuses at Microsoft thinking?). Here is where the ExcelToDBF add-in, developed by Andrea Bonfiglio, comes to the rescue.[3] Once you have download and installed the add-in, the ‘DBF IV’ option will be added to the ‘Save As’ menu. To illustrate, here is a screencast.

[1] Some Statalist posts hint that one can use Mata. Didn’t try that.
[2] Al Tongco of PhilGIS also suggested the free spreadsheet program OpenOffice Calc.
[3] I have also tried 2 other add-ins (SaveDBFIV and XLSX2DBF) but they returned an error when I tried to convert a huge file.

4 Responses

  1. Dear Vitor,

    Did you find a solution to your problem? I am running into the same error message.


    • hi, astrid. it might help if you include the exact codes you used so we have an idea where the error might be. thanks.

    • Hi, it seems that STATA doesn’t recongnize the shp file if it have the “M” attribute (Polygon M). I’m using ArcGis, so to solve this issue: ArcToolBox>Conversion Tools>To Shape File>Environments>M Values>Disable

  2. In my case, there is a error ”
    >>>25: point, polyine, or polygon shapefile required”
    but I’m using the shp.
    I dont know what to do…

Leave a Reply