Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: -foreach- syntax


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: -foreach- syntax
Date   Thu, 27 Oct 2005 23:32:38 +0100

The code below was too hasty. 

foreach x of var lcq?y???? {
 	local d : subinstr local x "lc" "dol" 
	local r : subinstr local x "lc" "ratio" 
  	gen `r' = `x' / `d'
}

Nick 
n.j.cox@durham.ac.uk 

Nick Cox
> 
> foreach x of var lcq?y???? {
> 	local d : subinstr local x "lc" "dol" 
>  	gen ratio`x'=lc`x'/dol`x'
> }
> 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index