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

Speaking Stata: How to face lists with fortitude

Author

Listed:
  • Nicholas J. Cox

    (University of Durham, UK)

Abstract

Three commands in official Stata, foreach, forvalues, and for, provide structures for cycling through lists of values (variable names, numbers, arbitrary text) and repeating commands using members of those lists in turn. All these commands may be used interactively, and none is restricted to use in Stata programs.They are explained and compared in some detail with a variety of examples.In addition,a self-contained exposition is given on local macros, understanding of which is needed for use of foreach and forvalues. Copyright 2002 by Stata Corporation.

Suggested Citation

  • Nicholas J. Cox, 2002. "Speaking Stata: How to face lists with fortitude," Stata Journal, StataCorp LP, vol. 2(2), pages 202-222, May.
  • Handle: RePEc:tsj:stataj:v:2:y:2002:i:2:p:202-222
    as

    Download full text from publisher

    File URL: http://www.stata-journal.com/sjpdf.html?articlenum=pr0005
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Nicholas J. Cox, 2001. "Speaking Stata: How to repeat yourself without going mad," Stata Journal, StataCorp LP, vol. 1(1), pages 86-97, November.
    2. Roger Newson, 2002. "Parameters behind "nonparametric" statistics: Kendall's tau,Somers' D and median differences," Stata Journal, StataCorp LP, vol. 2(1), pages 45-64, February.
    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. Nicholas J. Cox, 2009. "Speaking Stata: Rowwise," Stata Journal, StataCorp LP, vol. 9(1), pages 137-157, March.
    2. Nicholas J. Cox, 2008. "Stata tip 59: Plotting on any transformed scale," Stata Journal, StataCorp LP, vol. 8(1), pages 142-145, February.
    3. Nicholas J. Cox, 2007. "Speaking Stata: Identifying spells," Stata Journal, StataCorp LP, vol. 7(2), pages 249-265, June.
    4. Nicholas J. Cox, 2012. "Speaking Stata: Output to order," Stata Journal, StataCorp LP, vol. 12(1), pages 147-158, 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. John, Katrin & Thomsen, Stephan L., 2015. "School-track environment or endowment: What determines different other-regarding behavior across peer groups?," Games and Economic Behavior, Elsevier, vol. 94(C), pages 122-141.
    2. Guerra, Alice & Zhuravleva, Tatyana, 2021. "Do bystanders react to bribery?," Journal of Economic Behavior & Organization, Elsevier, vol. 185(C), pages 442-462.
    3. Cingl, Lubomír & Lichard, Tomáš & Miklánek, Tomáš, 2023. "Tax designation effects on compliance: An online experiment with taxpayers," Journal of Economic Behavior & Organization, Elsevier, vol. 214(C), pages 615-633.
    4. Lukasz Prorokowski, 2016. "Rank-order statistics for validating discriminative power of credit risk models," Bank i Kredyt, Narodowy Bank Polski, vol. 47(3), pages 227-250.
    5. Valeria Maggian & Natalia Montinari & Antonio Nicol�, 2018. "Backscratching in Hierarchical Organizations," The Journal of Law, Economics, and Organization, Oxford University Press, vol. 34(2), pages 133-161.
    6. Tomas Miklanek, 2017. "The Effect of Shame in Dictator Games with Information Asymmetry," CERGE-EI Working Papers wp581, The Center for Economic Research and Graduate Education - Economics Institute, Prague.
    7. Michelangelo Scorpio & Davide Carleo & Martina Gargiulo & Pilar Chías Navarro & Yorgos Spanodimitriou & Parinaz Sabet & Massimiliano Masullo & Giovanni Ciampi, 2023. "A Review of Subjective Assessments in Virtual Reality for Lighting Research," Sustainability, MDPI, vol. 15(9), pages 1-25, May.
    8. William Rhodes, 2014. "Pairwise Cluster Randomization," Evaluation Review, , vol. 38(3), pages 217-250, June.
    9. Nicholas J. Cox, 2010. "Speaking Stata: The statsby strategy," Stata Journal, StataCorp LP, vol. 10(1), pages 143-151, March.
    10. Miklánek, Tomáš, 2018. "Information Asymmetry and Exposure Effects in Dictator Games," Journal of Behavioral and Experimental Economics (formerly The Journal of Socio-Economics), Elsevier, vol. 77(C), pages 29-39.
    11. Regier, Dean A. & Bentley, Colene & Mitton, Craig & Bryan, Stirling & Burgess, Michael M. & Chesney, Ellen & Coldman, Andy & Gibson, Jennifer & Hoch, Jeffrey & Rahman, Syed & Sabharwal, Mona & Sawka, , 2014. "Public engagement in priority-setting: Results from a pan-Canadian survey of decision-makers in cancer control," Social Science & Medicine, Elsevier, vol. 122(C), pages 130-139.
    12. Peter, Eckley, 2015. "Measuring economic uncertainty using news-media textual data," MPRA Paper 64874, University Library of Munich, Germany, revised 01 May 2015.
    13. Bateman, Ian J. & Brouwer, Roy, 2006. "Consistency and construction in stated WTP for health risk reductions: A novel scope-sensitivity test," Resource and Energy Economics, Elsevier, vol. 28(3), pages 199-214, August.
    14. Nazim, Habibov & Elvin, Afandi, 2009. "Analysis of subjective wellbeing in low-income transitional countries: evidence from comparative national surveys in Armenia,Azerbaijan and Georgia," MPRA Paper 42720, University Library of Munich, Germany.
    15. Jose Saboin, 2018. "The Modern Hyperinflation Cycle: Some New Empirical Regularities," IMF Working Papers 2018/266, International Monetary Fund.
    16. Tosun, Jale, 2012. "Emergency oil stocks in Southeastern and Eastern Europe: What explains variation in convergence towards the EU model?," Energy Policy, Elsevier, vol. 46(C), pages 417-426.
    17. Roger B. Newson, 2010. "Comparing the predictive powers of survival models using Harrell’s C or Somers’ D," Stata Journal, StataCorp LP, vol. 10(3), pages 339-358, September.
    18. Chakrabarty, Manisha & Hildenbrand, Werner, 2011. "Engel's Law Reconsidered," Journal of Mathematical Economics, Elsevier, vol. 47(3), pages 289-299.
    19. Philipp Chapkovski & Luca Corazzini & Valeria Maggian, 2021. "Does Whistleblowing on Tax Evaders Reduce Ingroup Cooperation?," Working Papers 2021:20, Department of Economics, University of Venice "Ca' Foscari".
    20. Newson, Roger, 2005. "Efficient Calculation of Jackknife Confidence Intervals for Rank Statistics," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 15(i01).

    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:2:y:2002:i:2:p:202-222. 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.