IDEAS home Printed from https://ideas.repec.org/a/tsj/stataj/v9y2009i1p137-157.html
   My bibliography  Save this article

Speaking Stata: Rowwise

Author

Listed:
  • Nicholas J. Cox

    (Durham University, UK)

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.

Suggested Citation

  • Nicholas J. Cox, 2009. "Speaking Stata: Rowwise," Stata Journal, StataCorp LP, vol. 9(1), pages 137-157, March.
  • Handle: RePEc:tsj:stataj:v:9:y:2009:i:1:p:137-157
    as

    Download full text from publisher

    File URL: http://www.stata-journal.com/article.html?article=pr0046
    Download Restriction: no

    File URL: http://www.stata-journal.com/software/sj9-1/pr0046/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. William Gould, 2005. "Mata Matters: Using views onto the data," Stata Journal, StataCorp LP, vol. 5(4), pages 567-573, December.
    2. Nicholas J. Cox, 2002. "Speaking Stata: How to face lists with fortitude," Stata Journal, StataCorp LP, vol. 2(2), pages 202-222, May.
    3. David Kantor & Nicholas J. Cox, 2005. "Depending on conditions: a tutorial on the cond() function," Stata Journal, StataCorp LP, vol. 5(3), pages 413-420, September.
    4. Nicholas J. Cox & Gary M. Longton, 2008. "Speaking Stata: Distinct observations," Stata Journal, StataCorp LP, vol. 8(4), pages 557-568, December.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Hildenbrand, Andreas & Soviana, Soviana, 2015. "Über die Kriterien bei und die Zufriedenheit mit der Wahl eines Master-Studiengangs am Beispiel der agrarwissenschaftlichen Master-Studiengänge der Justus-Liebig-Universität Gießen," German Journal of Agricultural Economics, Humboldt-Universitaet zu Berlin, Department for Agricultural Economics, vol. 64(01), March.
    2. Hildenbrand, A. & Soviana, S., 2015. "Über die Kriterien bei, die Motive für und die Zufriedenheit mit der Wahl eines Masterstudiengangs am Beispiel der agrarwissenschaftlichen Master- Studiengänge des Justus-Liebig-Universität Gießen," Proceedings “Schriften der Gesellschaft für Wirtschafts- und Sozialwissenschaften des Landbaues e.V.”, German Association of Agricultural Economists (GEWISOLA), vol. 50, March.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Nicholas J. Cox, 2007. "Speaking Stata: Identifying spells," Stata Journal, StataCorp LP, vol. 7(2), pages 249-265, June.
    2. Nicholas J. Cox, 2008. "Stata tip 71: The problem of split identity, or how to group dyads," Stata Journal, StataCorp LP, vol. 8(4), pages 588-591, December.
    3. Nicholas J. Cox, 2007. "Speaking Stata: Counting groups, especially panels," Stata Journal, StataCorp LP, vol. 7(4), pages 571-581, December.
    4. Nicholas J. Cox, 2008. "Stata tip 59: Plotting on any transformed scale," Stata Journal, StataCorp LP, vol. 8(1), pages 142-145, February.
    5. Ignace De Vos & Gerdie Everaert & Ilse Ruyssen, 2015. "Bootstrap-based bias correction and inference for dynamic panels with fixed effects," Stata Journal, StataCorp LP, vol. 15(4), pages 986-1018, December.
    6. Nicholas J. Cox, 2006. "Speaking Stata: Graphs for all seasons," Stata Journal, StataCorp LP, vol. 6(3), pages 397-419, September.
    7. Nicholas J. Cox, 2011. "Stata tip 96: Cube roots," Stata Journal, StataCorp LP, vol. 11(1), pages 149-154, March.
    8. Nicholas J. Cox, 2007. "Stata tip 43: Remainders, selections, sequences, extractions: Uses of the modulus," Stata Journal, StataCorp LP, vol. 7(1), pages 143-145, February.
    9. Maarten L. Buis, 2007. "Stata tip 48: Discrete uses for uniform()," Stata Journal, StataCorp LP, vol. 7(3), pages 434-435, September.
    10. Nicholas J. Cox, 2011. "Speaking Stata: Fun and fluency with functions," Stata Journal, StataCorp LP, vol. 11(3), pages 460-471, September.
    11. Nicholas J. Cox, 2007. "Speaking Stata: Turning over a new leaf," Stata Journal, StataCorp LP, vol. 7(3), pages 413-433, September.
    12. Nicholas J. Cox, 2011. "Speaking Stata: Compared with..," Stata Journal, StataCorp LP, vol. 11(2), pages 305-314, June.
    13. Martin Weiss, 2009. "Stata tip 80: Constructing a group variable with specified group sizes," Stata Journal, StataCorp LP, vol. 9(4), pages 640-642, December.
    14. Nicholas J. Cox, 2012. "Speaking Stata: Output to order," Stata Journal, StataCorp LP, vol. 12(1), pages 147-158, March.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:tsj:stataj:v:9:y:2009:i:1:p:137-157. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christopher F. Baum or Lisa Gilmore (email available below). General contact details of provider: http://www.stata-journal.com/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.