Import Data from SAS and SPSS

SAS

Import a SAS file or a subset of it into Stata

Import SAS value labels

Convert dates and times from SAS to Stata format

Handle missing values

One of the first tasks of any research project is reading in data.
import sas allows us to import SAS® data from version 7 or higher into Stata.
We can import the entire dataset or only a subset of it.
With import sas we may also import value labels. Dates,
value labels, and missing values are all converted properly from SAS to
Stata format.

Let's see it work

We have a SAS dataset that contains Connecticut housing data provided by the
US Census Bureau's American Community Survey.

The dataset is named psam_h09.sas7bdat. To import it into Stata, we
open the import sas dialog box by clicking on File > Import > SAS
data (*.sas7bdat).

We can now import all the data or only a subset.

In this case, we want to import information-related communication
and technology. Specifically, we import variables recording whether
the household has internet access (ACCESS) and whether that internet is dial-up
service (DIALUP) or high-speed internet (HISPEED). We also import
variables recording whether they have a laptop or desktop (LAPTOP)
or other computer equipment (COMPOTHX). In addition, we import the
variable indicating whether they have a cellular data plan
(BROADBND).

Note that the variables have uppercase names in this SAS file.
We want all of them to be in lowercase. Under Variable case: we select
the option Lower.

We can now click OK to import the data.

As always, we could have used the command instead of the dialog box.
Here is what we would have typed:

One of the first tasks in any research project is reading in data.
import spss allows us to bring IBM® SPSS® files
(version 16 or higher) and compressed IBM SPSS files (version 21 or
higher) into Stata. We can import the entire dataset or only a subset of it.
Dates, value labels,
and missing values are all converted properly from SPSS to Stata format.

Let's see it work

We want to use the
General Social
Survey (GSS) for 2018, which we have in SPSS (.sav) format. The GSS gathers
demographic and socioeconomic information about individuals and also records
their perceptions about social, cultural, and economic issues.

The dataset we are interested in is GSS2018.sav. To bring it into Stata,
we open the dialog box by clicking on File > Import > SPSS data (*.sav).
We select the GSS2018.sav dataset and get

We can now import all the data or only a subset.

In this case, we are interested in data about people's confidence in
different institutions. We would like to see confidence in the military
(CONARMY), business and industry (CONBIZ), Congress (CONCONG), and the courts
and legal system (CONCOURT).

Note that the variables have uppercase names in this SPSS file.
We want all of them to be in lowercase. Under Variable
case:, we select the option Lower.

After clicking OK, our data are in Stata and are ready for us to analyze.

As always, we could have used the command line instead of the dialog box.
Here is what we would have typed: