Course dates: 4 - 8 November 2019
The aim of this course is to teach regular Stata users skills to get the most out of Stata and speed up their work. In addition to analytical commands, Stata also has powerful commands for manipulating data, and for extracting, formatting and exporting results. Ordinary Stata use can often be streamlined and automated using Stata’s programming commands and it is straightforward to develop and add new commands to Stata.
This course is aimed at researchers and other professionals, from any discipline, who want to learn how to work more efficiently with Stata. It would be particularly suited to those who are about to embark on large analyses. We teach you how to reduce the time and code needed for data preparation and analysis, and to generate bespoke, reproducible and well-presented results.
The course is taught by research staff from the Population Studies Group, who regularly use Stata for large-scale analyses using multiple data sources. The examples used in the course are drawn from the background of the tutors and are, therefore, from the population and health sciences. However, none require any specialist knowledge of the field.
Much of the material in the course has been developed with students and staff from the UK and overseas. Most teaching is hands-on, using Stata to tackle a series of exercises designed to illustrate the use of particular commands in order to solve a variety of problems. These exercises are supplemented by short lectures and a very comprehensive set of notes. There is a strong emphasis throughout on providing information that can be built on to tackle new problems and to be applied in different situations. Towards the end of the course we introduce structured exercises which bring together the skills learnt to tackle realistic challenges. Throughout the course, we encourage participants to apply what there are learning to their own data, and particular challenges and have dedicated session on Friday afternoon to explore these further.
We use Stata 15 in a Windows environment; users of other operating systems should note that, although almost everything is the same, there are some differences between operating systems and these are not covered in the course.
Who should attend?
The course is designed for people who are already experienced using Stata for data analysis and want to become more efficient. As a minimum, you should be able to use Stata for an analysis of some sort (linear regression, for example) generate, recode and label variables, and be comfortable writing comprehensive do files. If you are already familiar with the merge, collapse, reshape and append commands, have used foreach or forvalues loops and can understand a simple Stata program, then this course may be too basic for you. If, on the other hand, none of that sounds familiar, then this could be exactly what you need! If you have any doubt about whether the course would be suitable for you, please do get in touch with the organisers who will be able to advise you further. Applicants should have a good command of English.
The course can be divided broadly into three sections:
Data handling and manipulation
Stata has some powerful but simple commands for managing and manipulating data. We cover the commands needed to combine data from different datasets (appending and merging) and to rearrange data from wide format to long format. We will also cover searching for duplicate records, and managing these, reordering the variables in the dataset, generating summary variables and summary datasets.
Export and presentation of results
A general shortcoming of statistical software is the difficulty of producing bespoke and well-formatted results. The output in the Stata results window typically contains more detail than is required, and needs further formatting. Cutting and pasting is tedious when there are many results to present and inefficient when analyses have to be repeated.
It is possible to automatically output well formatted, concise and relevant results from Stata and there are number of ways to do this. Stata has excellent graph capabilities and we show you how to make the most of these. We teach a variety of methods to send the results you require, nicely formatted, to other datasets, to documents and spreadsheets and to text files. This includes the use of commands within Stata, additional user-written Stata commands and some simple programming.
Data cleaning, data management and the initial stages of many analyses can be repetitive and time consuming. Many of these repetitive tasks can be automated in Stata, which not only speeds up the process but also reduces the chances of making an error. We cover the use of basic programming techniques to assist you in quickly and efficiently carrying out repetitive tasks. We also teach you to write a Stata program to create new Stata commands.
Aims & objectives
By the end of the course, you should be able to:
- Generate variables that contain summaries of the data
- Create a summary dataset using collapse
- Navigate a dataset using system variables _n, _N and subscripted variables
- Rearrange a dataset using reshape
- Combine multiple datasets using merge and append
- Identify duplicate observations
Export and presentation of results
- Export data to a spreadsheet
- Create tailor-made publication quality graphs
- Know how to export results using user-written commands: estout
- Be able to write a do-file which exports results using file write
- Be able to write a do-file which exports results to word documents using putdocx
- Be familiar with other commands for accessing and outputting results such as putexcel
- Understand what macros and scalars are
- Be able to use foreach and forvalues loops
- Understand and use if statements
- Understand how Stata stores estimation results
- Be able to access and use stored estimation results
- Understand how Stata programs work
- Be able to write and use a simple Stata program
Methods of assessment
None. There will be an opportunity on the last afternoon for students to practice with their own datasets. A certificate of attendance will be provided on completion of the course.
The student is responsible for obtaining any visa or other permissions to attend the course, and is encouraged to start the application process as early as possible as obtaining a visa for the UK can sometimes take a long time. The Short Courses team can provide supporting documentation if requested.
Accommodation and meals
A list of hotels located in the vicinity of LSHTM, along with further resources for short term accommodation, can be found on our accommodation pages. Tea and coffee vouchers will be provided during breaks.
Evening meals are not catered for at LSHTM, however there is a large choice of restaurants, cafés and shops nearby.
- If you have been offered a place on the course you will not be able to register without bringing formal ID (Passport) and without having obtained the correct visa if required.
- It is essential that you read the current visa requirements for short course students.
- LSHTM may cancel courses two weeks before the first day of the course if numbers prove insufficient. In those circumstances, course fees will be refunded.
- LSHTM cannot accept responsibility for accommodation, travel and other losses incurred as a result of the course being cancelled.