Speaking Stata: Loops in parallel
Nicholas Cox
Stata Journal, 2021, vol. 21, issue 4, 1047-1064
Abstract:
This column is a tutorial discussing looping in parallel using foreach and forvalues. Such looping may use not only local macros defined for the purpose but also other devices, including the gettoken command and ways to increment and decrement other macros and to evaluate other expressions. The main idea is that a set of loops in parallel is essentially one loop with two or more sets of parallel actions. Examples cover looping over integers with a required specific display format, generating new variables and defining variable labels at the same time, binning variables as desired, and putting skewness results in new variables. The last example includes some historical comments on the tangled literature on skewness measures using medians and quantiles.
Keywords: loops; foreach; forvalues; macros; gettoken; tokenize; skewness (search for similar items in EconPapers)
Date: 2021
Note: to access software from within Stata, net describe http://www.stata-journal.com/software/sj21-4/pr0075/
References: Add references at CitEc
Citations:
Downloads: (external link)
http://www.stata-journal.com/article.html?article=pr0075 link to article purchase
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:tsj:stataj:v:21:y:2021:i:4:p:1047-1064
Ordering information: This journal article can be ordered from
http://www.stata-journal.com/subscription.html
DOI: 10.1177/1536867X211063415
Access Statistics for this article
Stata Journal is currently edited by Nicholas J. Cox and Stephen P. Jenkins
More articles in Stata Journal from StataCorp LLC
Bibliographic data for series maintained by Christopher F. Baum () and Lisa Gilmore ().