
From  Philipp Rehm <Philipp.Rehm@gmx.de> 
To  statalist@hsphsun2.harvard.edu 
Subject  Re: st: executing a command based on the prefix of variables 
Date  Thu, 28 Sep 2006 15:00:08 +0200 
I have a data set that contains variables like;
telephone
telephoneno
telephonesh
telephoneshno
clock
clockno
cltv
cltvno
bicycle
bicycleno
bicyclesh
bicycleshno
and many more. As you can see, they take the form of ;
"name of item"
"name of item"no; or
["name of item"sh / "name of item"shno, whenever appropriate].
I would like to tell STATA to look at the names of variables and execute;
tabstat `var', s(mean n max min med) c(s)
only for the set of variables that contains the same prefix, and loop over the
next set of variables, and then next, and so on.
I tried to embed ifcmd or subinstr command in the loop but haven't been able
to pull it off. I feel like I'm missing out something very basic.
Thanks in advance for your help.
Yusuke
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
* * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/
© Copyright 1996–2016 StataCorp LP  Terms of use  Privacy  Contact us  What's new  Site index 