Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: using different macros everytime


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: using different macros everytime
Date   Mon, 16 Jun 2008 10:28:40 +0100

Sorry, typo correction: 

forval t = 1/`Tx' {

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 16 June 2008 10:15
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: using different macros everytime

Going back to your original example: 

local xset `" "x1 x2" "x1 x2 x3" "' 
local zset `" "x1 x2 v1" "x1 x2 x3 v1" "' 

* start of stuff for program or do file only 

local Tx : word count `xset' 
local Tz : word count `zset' 

if `Tx' != `Tz' { 
	di as err "no go; numbers of x sets and z sets do not match"
	exit 498 
}

* end of stuff for program or do file only 

forval t = 1/`T' { 
	local x : word `t' of `xset' 
	local z : word `t' of `zset' 
	treatreg y1 `x', treat(y2 = `z') 
}  

I can't see much advantage in doing it this way unless the number of
sets is much larger than in the example. 

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

*
*   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