Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: construct a loop

From   "Daniel Klein" <>
Subject   Re: st: construct a loop
Date   Sun, 20 Feb 2011 00:58:15 +0100


although I do (did) not know the -stmh- command, I think the following short program should do what you are asking for.


cap prog drop foo

prog foo
   syntax varlist(numeric)
   foreach var of loc varlist {
      qui levelsof `var' ,loc(lvls)
         forval j = 2/`: word count `lvls'' {
            loc i = `j' - 1
	       forval k = 1/`i' {
	          stmh ,c(`: word `j' of `lvls'',`: word `k' of `lvls'')


NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren:
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index