Stata Programming “A little bit of Programming goes an awfully long way…”

“A little bit of Stata Programming goes an awfully long way”…. The underlying objective of this summer school is to illustrate the ways in which some very basic programming tools can be easily implemented in Stata in order to facilitate, automate, replicate and personalize both data analysis/management and data presentation. To this end participants are provided with a core set of programming tools and techniques, that are prerequisites for a more effective, time saving use of the software.


During the course of the summer school, participants will be shown how to write, modify and develop do files (Stata programs). At the end of the three days, it is expected that participants are able to personalize existing Stata commands and develop their own do files in order to organize their workload in a more automated, flexible, reproducible manner. This would allow them, for example, to ultimately be in a position to delegate the more repetitive tasks of data management, data analysis and data presentation in Stata.


In common with TStat’s workshop philosophy, each individual session is composed of both a theoretical component (in which the techniques and underlying principles behind them are explained), and an applied (hands-on) segment, during which participants have the opportunity to implement the techniques using real data under the watchful eye of the course tutor. Throughout the summer school, theoretical sessions are reinforced by case study examples, in which the course tutor discusses and highlights potential pitfalls and the advantages of individual techniques.

This school will prove invaluable to both researchers and professionals across a wide spectrum of fields (Biostatistics, Economics, Epidemiology, Political and Social Sciences, Public Health), wishing to progress to a more advanced, efficient and automated use of Stata.

Familiarity/working knowledge of Stata. Participants are not however, required to have any programming experience in Stata or in other statistical packages.

DAYS 1-2



SESSION I – PROGRAMMING: Some Fundamental Concepts

Do and ado files in Stata

Data types: Working with Dates and Time, Time Series Operators, Factor Variables

Debugging – the capture command

Protecting your data with preserve and restore

Guidelines for writing programs in Stata


SESSION II – PROGRAMMING STATA DO-FILES: Some Basic Programming Commands and Tools

Local macros

Global macros

Transformation of string and numeric variables

Recoding discrete and continuous variables

Recoding missing variables

Generate and egen functions

Local and global macros

Extended macro functions and list functions

Scalars and matrices

Temporary variables and tempnames

Looping commands: forvalues and foreach

By, statsby, rolling and other prefix commands

Transforming data with reshape

Combining datasets with append and merge



SESSION III – Programming Concepts and Tools in Action

Tabulating and computing statistics across a set of variables and groups

Computing durations and aggregating transactions data

Summarizing group characteristics over observations

Sdding aggregate characteristics to micro observations

Reusing results : return and ereturn commands

Accessing estimation results and margins


SESSION IV – AUTOMATION: Do-file Programming Makes Life a Lot Easier

Storing results in matrices

Stata’s post and postfile commands

Automating estimation output – the user-written commands estout and tabout, saveresults

Automating graphical output



SESSION V  – Ado File Programming

Structure of an ado-file

Syntax and return statements

Using program options

Including subset of observations

Generalizing commands to handle multiple variables

Rendering commands byable

Writing an e-class program

Programs for egen, ml, nl

Programs for gmm

Guidelines for ado-file programming style


SESSION VI –  Introduction to Mata

Mata Fundamentals

A simple Mata function

Components of a Mata function

Calling Mata functions

Mata’s st_interface functions

Mata-based likelihood function evaluators

Creating arrays of temporary objects with pointers


Additional Mata features

The summer school is expected in Florence from 18-20 September 2017 from 9:00 am to 5:00 pm


PLACE: Centro Studi CISL ♦ Via della Piazzuola, 71 ♦ I-50123 Florence, Italy



Students*: € 896.00

Academic: € 1494.00

Government /Nonprofi t: € 1658.00

Commercial: € 1823.00


*To be eligible for student prices, participants must provide proof of their full-time student status for the current academic year.


All fees are subject to VAT (applied at the current Italian rate of 22%).


Please note that a non-refundable deposit of €100.00 for students and €200.00 for academic, Government/Nonprofit and commercial participants, is required to secure a place and is payable upon registration. The number of participants is limited to 15. Places will be allocated on a first come, first serve basis.


Course fees cover: i) teaching materials (copies of lecture slides, databases and Stata routines used during the school); ii) a temporary licence of Stata valid for 30 days from the beginning of the school; iii) half board accommodation (breakfast, lunch and coffee breaks) in a single room at the Centro Studi CISL from Saturday 17th to Tuesday 20th September 2017 (3 nights).


In order to maximize the usefulness of this school, we recommend that participants bring their own laptops with them, in order to be able to actively participate in the empirical sessions.


Individuals interested in attending this school must return their completed registration forms either by email ( or by fax (+39 0864 206014) to TStat by the 3rd of September 2017.

L’iscrizione al corso dovrà avvenire tramite lo specifico modulo di registrazione e pervenire a TStat S.r.l. almeno 15 giorni prima dell’inizio del corso stesso. E’ possibile richiedere il modulo di registrazione compilando il seguente form oppure inviando una mail a





Termini e condizioni*
Autorizzo il trattamento dei dati personali ai sensi dell'articolo 13 del D.lgs. n.196/2003 - Testo completo

The underlying objective of this summer school is to illustrate the ways in which some very basic programming tools can be easily implemented in Stata in order to facilitate, automate, replicate and personalize both data analysis/management and data presentation.