Importing data to STATA

STATA comes with a set of sample data files. This helps the learner in understanding how different set of tests can be applied to single data. For the purpose of understanding this module I will be using auto.dta and will be applying some tests to this data. However, importing data from MS excel to STATA is important.

Selecting example datasets

In order to select example datasets, click on File and scroll down to example datasets. Click on “Example Datasets…”. A new window will open. There will be two options:

  1. Example Datasets installed with STATA
  2. STATA Manual Datasets

While option 1 provides different datasets in STATA, that were installed as default with the software. On the other hand, option 2 will enable to have web access all the datasets which have been computed using STATA.

To full fill the purpose of this article select option 1. After which a new page will open that enlists different datasets. For every dataset you can use 2 options, i.e. use or describe. When you Click “Describe”, it will give you the description of dataset variables in Output window and when you click “Use” it will reflect all the variables in Variable window.

Importing data to Data Editor

Since we have selected an Example Dataset, the data for each variable is  automatically transferred to data editor window (see below):

importing the example data set from stata to main window

Importing example data set from STATA

If the data is stored in excel, then import the data to STATA by copying the data from MS Excel into the Data Editor. In order to do so, click on the Data Editor icon on the bar as shown below:

Importing data from microsoft Excel to stata

Importing data from Microsoft Excel

While pasting the data in the data editor window, it will give you two options:

  1. Treat first row as data
  2. Treat first row as variable names

In cases where there are variable names we will select Option 2 so that the variables names are added on the top row. The Data Editor like MS excel allows the analyst to make changes in the responses if and when needed.

Shruti Datt

Shruti Datt

Project Handler at Project Guru
Shruti is B-Tech & M-Tech in Biotechnology. Some of her strengths include, Good interpersonal skills, eye for detail, well devised analytical and decision making skills and a positive attitude towards life. Her aim in life is to obtain a responsible and challenging position where her education and work experience will have valuable application.
She is a true Piscean. She loves doing things to perfection with passion. She is very creative and likes to make personalized gifts for her dear ones, this is actually something that keeps her going. Shruti loves adventure sports and likes river rafting and cliff jumping.
Shruti Datt

Related articles

  • Correlation analysis using STATA Correlation analysis is conducted to examine the relationship between dependent and independent variables. There are two types of correlation analysis in STATA.
  • Lag selection and cointegration test in VAR with two variables The previous article showed that the three-time series values Gross Domestic Product (GDP), Gross Fixed Capital Formation (GFC) and Private Final Consumption (PFC) are non-stationary. Therefore they may have long-term causality. The general assumption, in this case, is that consumption […]
  • Johansen cointegration test in VAR with three variables The previous article showed lag selection and stationarity for Vector Auto Regression (VAR) with three variables; Gross Domestic Product (GDP), Gross Fixed Capital Formation (GFC) and Private Final Consumption (PFC). This article shows the co-integration test for VAR with three variables.
  • Granger causality test in STATA Applying Granger causality test in addition to cointegration test like Vector Autoregression (VAR) helps detect the direction of causality. It also helps to identify which variable acts as a determining factor for another variable. This article shows how to apply Granger causality test in STATA.
  • VECM in STATA for two cointegrating equations Unrestricted Vector Auto Regression (VAR) is not applicable in such cases. Vector Error Correction Model (VECM) is a special case of VAR which takes into account the cointegrating relations among the variables.

Discuss

We are looking for candidates who have completed their master's degree or Ph.D. Click here to know more about our vacancies.