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

st: RE: RE: -foreach- syntax


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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 
[email protected] 

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