Advanced Search
MyIDEAS: Login

A shortcut through long loops: An illustration of two alternatives to looping over observations

Contents:

Author Info

  • Ward Vanlaar

    (Traffic Injury Research Foundation, Ottawa)

Registered author(s):

    Abstract

    It is well known that looping over observations can be slow and should be avoided. The objective of this article is to discuss two alternative solutions to looping over observations that can be used to overcome a particular data-management problem of merging datasets in which unique key identifiers changed over time. The first alternative, mapch, which is introduced in this article, uses a combination of appending, indexing, and merging to solve the problem, while the second alternative uses repeated merging. Both solutions are much quicker than looping over observations. However, depending on the nature of the problem, one solution may work better than the other. It is argued that the use of such dataset-type manipulations may be suitable to overcome other data-management problems. More generally speaking, the issue that is addressed—searching for an alternative to looping over observations—may be common and illustrates the importance of balancing the costs of developing an efficient solution with the benefits accruing from that solution. Copyright 2008 by StataCorp LP.

    Download Info

    If you experience problems downloading a file, check if you have the proper application to view it first. In case of further problems read the IDEAS help page. Note that these files are not on the IDEAS site. Please be patient as the files may be large.
    File URL: http://www.stata-journal.com/article.html?article=dm0041
    Download Restriction: no

    File URL: http://www.stata-journal.com/software/sj8-4/dm0041/
    Download Restriction: no

    Bibliographic Info

    Article provided by StataCorp LP in its journal Stata Journal.

    Volume (Year): 8 (2008)
    Issue (Month): 4 (December)
    Pages: 540-553

    as in new window
    Handle: RePEc:tsj:stataj:v:8:y:2008:i:4:p:540-553

    Contact details of provider:
    Web page: http://www.stata-journal.com/

    Order Information:
    Web: http://www.stata-journal.com/subscription.html

    Related research

    Keywords: mapch; appending; data management; indexing; looping; merging;

    References

    No references listed on IDEAS
    You can help add them by filling out this form.

    Citations

    Lists

    This item is not listed on Wikipedia, on a reading list or among the top items on IDEAS.

    Statistics

    Access and download statistics

    Corrections

    When requesting a correction, please mention this item's handle: RePEc:tsj:stataj:v:8:y:2008:i:4:p:540-553. See general information about how to correct material in RePEc.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: (Christopher F. Baum) or (Lisa Gilmore).

    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 references are entirely missing, you can add them using this form.

    If the full references list an item that is present in RePEc, but the system did not link 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 profile, as there may be some citations waiting for confirmation.

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