Stata 15 help for spshape2dta

[SP] spshape2dta -- Translate shapefile to Stata format

Syntax

spshape2dta name [, options]

options Description ------------------------------------------------------------------------- clear clear existing data from memory replace if name.dta or name_shp.dta exists, replace them saving(name2) create new files named name2.dta and name2_shp.dta instead of name.dta and name_shp.dta -------------------------------------------------------------------------

spshape2dta translates files name.shp and name.dbf. They must be in the current directory.

spshape2dta creates files name.dta and name_shp.dta. They will be created in the current directory. The data in memory, if any, remain unchanged.

Menu

Statistics > Spatial autoregressive models

Description

spshape2dta name reads files name.shp and name.dbf and creates Sp dataset name.dta and translated shapefile name_shp.dta. The translated shapefile will be linked to the Sp dataset name.dta.

Options

clear specifies to clear any data in memory.

replace specifies that if the new files being created already exist on disk, they can be replaced.

saving(name2) specifies that rather than the new files being named name.dta and name_shp.dta, they be named name2.dta and name2_shp.dta.

Example

In your browser, search for "shapefile U.S. counties census" and find https://www.census.gov/geo/maps-data/data/tiger.html.

Click on TIGER/Line Shapefiles - New 2016 Shapefiles. Doing so takes you to a page with a list of years. Select "2016" and click on Download. If given a choice between a web interface and an FTP site, click on Web interface. Then select 2016 and Counties (and equivalent) and click on Submit. On the new screen, click on Download national file.

File tl_2016_us_county.zip was downloaded to the Downloads directory on our computer.

You must be in the Downloads directory (that is, the same directory as this file) to run the spatial commands.

Unzip the files . unzipfile tl_2016_us_county.zip

Dataset setup . spshape2dta tl_2016_us_county


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index