SlideShare a Scribd company logo
1 of 119
STATA: Data Analysis Software




               STATA
             Merge or Drop Data


             www.STATA.org.uk
               Step-by Step Screenshot Guides
                    to help you use STATA

                Not affiliated with Stata Corp.
Datasets Used in Tutorial




   – Datasets in these tutorials are based on examples in:

        Stock and Watson (2006)
            “Introduction to Econometrics”

   – You can obtain all of the datasets used in these tutorials
     by downloading a STATA command file from
     http://www.stata.org.uk/download-examples.html
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
Outline



  - Data Management
          • Sort                • Order
          • Keep variables      • Drop variables
          • Keep observations   • Drop observations
          • Merge               • Append
          • If                  • By
          • Encode              • Dates
          • Egen
www.STATA.org.uk




   – If you visit www.STATA.org.uk you can download
     tutorials on these other topics:

       Data Management      Statistical Analysis
       Importing Data       Summary Statistics
       Graphs               Linear Regressions
       Presenting Output    Panel Regressions
       Merge or Drop Data   Time Series Analysis
                            Instrumental Variables
                            Probit Analysis

More Related Content

Viewers also liked

STATA - Instrumental Variables
STATA - Instrumental VariablesSTATA - Instrumental Variables
STATA - Instrumental Variablesstata_org_uk
 
STATA - Panel Regressions
STATA - Panel RegressionsSTATA - Panel Regressions
STATA - Panel Regressionsstata_org_uk
 
Presentation on GMM
Presentation on GMMPresentation on GMM
Presentation on GMMMoses sichei
 
STATA - Probit Analysis
STATA - Probit AnalysisSTATA - Probit Analysis
STATA - Probit Analysisstata_org_uk
 
Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011Moses sichei
 
Using STATA in Survey Data Analysis - Niveen El Zayat
Using STATA in Survey Data Analysis - Niveen El ZayatUsing STATA in Survey Data Analysis - Niveen El Zayat
Using STATA in Survey Data Analysis - Niveen El ZayatEconomic Research Forum
 
Introduction to Stata
Introduction to StataIntroduction to Stata
Introduction to Stataizahn
 
Econometria Salida Stata
Econometria Salida StataEconometria Salida Stata
Econometria Salida StataIlse Herrera
 
Applied Econometrics assignment3
Applied Econometrics assignment3Applied Econometrics assignment3
Applied Econometrics assignment3Chenguang Li
 
The Law School Bubble
The Law School BubbleThe Law School Bubble
The Law School BubbleGaetan Lion
 
Regresion lineal multiple_3
Regresion lineal multiple_3Regresion lineal multiple_3
Regresion lineal multiple_3karinita12
 
Unrestricted var out
Unrestricted var outUnrestricted var out
Unrestricted var outGaetan Lion
 
Quantitative method intro variable_levels_measurement
Quantitative method intro variable_levels_measurementQuantitative method intro variable_levels_measurement
Quantitative method intro variable_levels_measurementKeiko Ono
 
Lecture notes on Johansen cointegration
Lecture notes on Johansen cointegrationLecture notes on Johansen cointegration
Lecture notes on Johansen cointegrationMoses sichei
 
Regression topics
Regression topicsRegression topics
Regression topicsGaetan Lion
 

Viewers also liked (19)

STATA - Instrumental Variables
STATA - Instrumental VariablesSTATA - Instrumental Variables
STATA - Instrumental Variables
 
STATA - Panel Regressions
STATA - Panel RegressionsSTATA - Panel Regressions
STATA - Panel Regressions
 
Presentation on GMM
Presentation on GMMPresentation on GMM
Presentation on GMM
 
STATA - Probit Analysis
STATA - Probit AnalysisSTATA - Probit Analysis
STATA - Probit Analysis
 
Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011
 
Stata tutorial university of princeton
Stata tutorial university of princetonStata tutorial university of princeton
Stata tutorial university of princeton
 
Introduction to Stata
Introduction to Stata Introduction to Stata
Introduction to Stata
 
Using STATA in Survey Data Analysis - Niveen El Zayat
Using STATA in Survey Data Analysis - Niveen El ZayatUsing STATA in Survey Data Analysis - Niveen El Zayat
Using STATA in Survey Data Analysis - Niveen El Zayat
 
Introduction to Stata
Introduction to StataIntroduction to Stata
Introduction to Stata
 
Econometria Salida Stata
Econometria Salida StataEconometria Salida Stata
Econometria Salida Stata
 
Applied Econometrics assignment3
Applied Econometrics assignment3Applied Econometrics assignment3
Applied Econometrics assignment3
 
The Law School Bubble
The Law School BubbleThe Law School Bubble
The Law School Bubble
 
Regresion lineal multiple_3
Regresion lineal multiple_3Regresion lineal multiple_3
Regresion lineal multiple_3
 
Unrestricted var out
Unrestricted var outUnrestricted var out
Unrestricted var out
 
Quantitative method intro variable_levels_measurement
Quantitative method intro variable_levels_measurementQuantitative method intro variable_levels_measurement
Quantitative method intro variable_levels_measurement
 
Deep Learning
Deep LearningDeep Learning
Deep Learning
 
Lecture notes on Johansen cointegration
Lecture notes on Johansen cointegrationLecture notes on Johansen cointegration
Lecture notes on Johansen cointegration
 
Causality detection
Causality detectionCausality detection
Causality detection
 
Regression topics
Regression topicsRegression topics
Regression topics
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

STATA - Merge or Drop Data

  • 1. STATA: Data Analysis Software STATA Merge or Drop Data www.STATA.org.uk Step-by Step Screenshot Guides to help you use STATA Not affiliated with Stata Corp.
  • 2. Datasets Used in Tutorial – Datasets in these tutorials are based on examples in: Stock and Watson (2006) “Introduction to Econometrics” – You can obtain all of the datasets used in these tutorials by downloading a STATA command file from http://www.stata.org.uk/download-examples.html
  • 3. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 34.
  • 35.
  • 36.
  • 37.
  • 38. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 70.
  • 71.
  • 72.
  • 73.
  • 74. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108. Outline - Data Management • Sort • Order • Keep variables • Drop variables • Keep observations • Drop observations • Merge • Append • If • By • Encode • Dates • Egen
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119. www.STATA.org.uk – If you visit www.STATA.org.uk you can download tutorials on these other topics: Data Management Statistical Analysis Importing Data Summary Statistics Graphs Linear Regressions Presenting Output Panel Regressions Merge or Drop Data Time Series Analysis Instrumental Variables Probit Analysis