Dear all,
I have a question concerning the command shp2dta in Stata 13.1:
In order to later use the command spmap to map some of my data, I would like to use shp2dta in order to convert my shp files to dta files. Since I want to create a map of the European Union divided into small regions as definced by the statistical NUTS 2016 specification, I want to use the publicly available shp files provided by Eurostat.
I didn't find a way to use e.g. dataex to post a convinient data example, so I'm left with openly stating which data I want to use: The data can be found here: https://ec.europa.eu/eurostat/de/web...cal-units/nuts , NUTS 2016, 1:1 Million, File format: SHP -> open e.g. ZIP file NUTS_BN_01M_2016_3857.shp.zip -> download NUTS_BN_01M_2016_3857.shp and NUTS_BN_01M_2016_3857.dbf .
My commands so far are:
(database(eudb) specifies that the database file is named eudb.dta, coordinates(eucoord) specifies that the coordinate file is named eucoord.dta and genid(id) specifies that the ID variable created in eudb.dta is named "id".)
Executing these commands provides me with only one new file (“eucoord.dta”) and Stata issues the message:
type: 3
NUTS_BN_01M_2016_3857.dbf: invalid dBASE data type
r(610);
... stating that my designated file is not a Stata-format file. What am I doing wrong?
On a side note, I have tried the following: opening the dbf file in Excel, copy-pasting the shown data into the Stata Data Editor, checking “Treat first row as variable names”, and then manually saving this as eudb.dta in “C:\SHP_files”. This way, I am able to create maps, e.g. (a rather useless one) indicating the number of the variable nuts_bn_id:
Does somebody have an idea why Stata might not recognize the dbf file as a valid data type when using shp2dta?
Thank you in advance and Best wishes,
Françoise
I have a question concerning the command shp2dta in Stata 13.1:
In order to later use the command spmap to map some of my data, I would like to use shp2dta in order to convert my shp files to dta files. Since I want to create a map of the European Union divided into small regions as definced by the statistical NUTS 2016 specification, I want to use the publicly available shp files provided by Eurostat.
I didn't find a way to use e.g. dataex to post a convinient data example, so I'm left with openly stating which data I want to use: The data can be found here: https://ec.europa.eu/eurostat/de/web...cal-units/nuts , NUTS 2016, 1:1 Million, File format: SHP -> open e.g. ZIP file NUTS_BN_01M_2016_3857.shp.zip -> download NUTS_BN_01M_2016_3857.shp and NUTS_BN_01M_2016_3857.dbf .
My commands so far are:
Code:
cd: "C:\SHP-files" shp2dta using NUTS_BN_01M_2016_3857, database(eudb) coordinates(eucoord) genid(id)
Executing these commands provides me with only one new file (“eucoord.dta”) and Stata issues the message:
type: 3
NUTS_BN_01M_2016_3857.dbf: invalid dBASE data type
r(610);
... stating that my designated file is not a Stata-format file. What am I doing wrong?
On a side note, I have tried the following: opening the dbf file in Excel, copy-pasting the shown data into the Stata Data Editor, checking “Treat first row as variable names”, and then manually saving this as eudb.dta in “C:\SHP_files”. This way, I am able to create maps, e.g. (a rather useless one) indicating the number of the variable nuts_bn_id:
Code:
gen number = nuts_bn_id spmap number using eucoord, id(nuts_bn_id)
Thank you in advance and Best wishes,
Françoise
Comment