Home  >>  Archives  >>  Volume 9 Number 1  >>  pr0046

The Stata Journal
Volume 9 Number 1: pp. 137-157



Subscribe to the Stata Journal
cover

Speaking Stata: Rowwise

Nicholas J. Cox
Department of Geography
Durham University
Durham City, UK
[email protected]
Abstract.   Stata’s main data model treats observations in rows and variables in columns quite differently, but rowwise problems also arise that require working against the grain. This column shows how to exploit existing functions and egen functions when they exist and apply to such problems. It offers advice on how to build your own loops, egen functions, or programs when needed. Mata provides especially convenient tools for constructing many such functions and programs, centered on putting selected data into matrices and then processing each observation as a separate vector. Two programs, rowsort and rowranks, are formally published with this column.
Terms of use     View this article (PDF)

View all articles by this author: Nicholas J. Cox

View all articles with these keywords: rowsort, rowranks, rows, functions, loops, egen, Mata, minimum, maximum, median, any, all, distinct values, sorting, ranking

Download citation: BibTeX  RIS

Download citation and abstract: BibTeX  RIS